I’ve recently got an issue while uploading image file in Symfony php-framework application.
My system configuration:
- OS Debian Squezee/sid
- Symfony version 1.2.1
- PHP 5.3.2.2 with Suhosin
- Apache
The initial problem was, that nothing has been uploaded. Due to standard validation snippet in my actions.class.php file:
if ( $form->isValid() )
{
...
}
Just comment this if and get an error:
Invalid mime type (image/jpeg; charset=binary)
To solve the problem, it is needed to change the form enhancement class a bit:
$this->validatorSchema['image_field_in_form'] = new sfValidatorFile(array(
'required' => true,
'path' => sfConfig::get('sf_upload_dir').'/images',
//'mime_types' => 'web_images',
'mime_types' => array(
'image/jpeg',
'image/pjpeg',
'image/gif',
'image/png',
'image/x-png',
'image/jpeg; charset=binary',
'image/pjpeg; charset=binary',
'image/gif; charset=binary',
'image/png; charset=binary',
'image/x-png; charset=binary',
)
));
That’s it.
try getting McAfee Registry Cleaner… download it
uploadfiles…
[...]Symfony MIME-type problem uploading image files « Yureg's Development Flow[...]…