Imran Azad
Imran Azad

Reputation: 1404

Word doc extension being changed to .bin upon upload

Word documents that are uploaded with the .doc extension in my application are uploaded as .bin files. Here is the form code:

$this->setValidator('upload_report', new sfValidatorFile(array(
    'mime_type_guessers' => array('guessFromFileinfo'),
    'path' => sfConfig::get('sf_upload_dir').'/reports',
    'required' => $required,
 )));

Any ideas why it's doing this?

Thanks

Upvotes: 0

Views: 515

Answers (1)

Jonathan Rich
Jonathan Rich

Reputation: 1738

Symfony tries to guess the mime type of the file and names the file based on the detected mime type. I've had this problem in the past, and fixed it in my preSave method to move the file.

Upvotes: 1

Related Questions