开发者

mime_types for upload pdf files - symfony

开发者 https://www.devze.com 2023-04-02 12:58 出处:网络
I have 开发者_C百科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 we

I have 开发者_C百科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.


Remove 'mime_types' => 'web_images'


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'
        )));
0

精彩评论

暂无评论...
验证码 换一张
取 消