Eva Dias
Eva Dias

Reputation: 1747

mime_types for upload pdf files - symfony

I have a file upload field and in my configure() I've putted 'mime_types' => 'web_images' but this give me an error when I upload pdf files... what do I nedd to write instead of web_images to be able to upload pdf's? Thank you.

Upvotes: 0

Views: 2922

Answers (2)

macgyver
macgyver

Reputation: 1279

You have to set right mime category:

$this->setValidator('my_upload_widget', new sfValidatorFile(array(
            'required'        => false,
            'path'            => sfConfig::get('sf_upload_pdf_dir'),
            'mime_categories' => array('pdf' => array('application/pdf', 'application/x-pdf')),
            'mime_types'      => 'pdf'
        )));

Upvotes: 1

denys281
denys281

Reputation: 2014

Remove 'mime_types' => 'web_images'

Upvotes: 1

Related Questions