开发者

mime_types for upload pdf files - symfony

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜