In my Symfony application, I want to set zip file as one of the mime type during the file upload, the code to do this is below:
$this->validatorSchema ['Documents'] = new sfValidatorFile (
array ('mime_types' => array(
'application/zip',
'image/jpeg',
'image/pjpeg',
'image/png',
'image/x-png',
'image/gif',
'application/x-zip',
'application/octet-stream',
'application/pdf') ),
array ('invalid' => 'Invalid file.',
'required' => 'Select a file to upload.',
'mime_types' => 'The file must be of JPEG, PNG , GIF, pdf and zip format.' ) );
However, when I did the uploads, I found that all of pdf
, png
, gif
etc can be uploaded. The only mime type that cannot be uploaded, are files that end with .zip
.
What's going wrong here?
I asked a related, but different question here.
Note: I am using Symfony 1.2.7
Edit: I did some further testing with different browsers. Firefox 3 works because of 'application/octet-stream'', whereas IE works because of 'application/x-zip-compressed', Google Chrome doesn't work at all.