Pdf upload problem with QFileAsset in FF 3.0.18

thread: 3 messages  |  last: a year ago  |  started: sunday, april 4, 2010, 10:42 am pdt


#1  |  Gaspar Attila (Odorheiu Secuiesc, RO) Romania
Sunday, April 4, 2010, 10:42 AM PDT

Hello,

I created a QFileAsset with QFileAssetType::Pdf as acceptable file, and when uploading the pdf file the “Must be a Pdf” error appear, but with the same control if I upload another file which is not a pdf or not an image (so not an acceptable file type) the file uploaded successfully.

I verified why when upload pdf appear that error. In FF 3.0.18 when uploading pdf file, the mime type set to “application/force-download” and this mime type not in acceptable mime type array. I also tested this in IE where I get the correct mime type (application/pdf).

Also if I try to upload a file which is not a pdf the upload proccess run with success because most file  mime type set to “application/octet-stream” which is in the acceptable mime type array when FileAssetType set to Pdf. This also happen in IE.



UPDATE:

Problem tested in FF 3.5.8  where the correct mime type set (application/pdf).
That is annoying if FF change mime types from version to version.

Attila

#2  |  Fernando Lordán (Barcelona, CAT, Spain) Spain
Sunday, April 4, 2010, 11:13 AM PDT

Thanks for such a detailed report. Reports like this always help people that find themselves in similar situations.

#3  |  Mike Ho (Sunnyvale, CA) United States of America Qcodo Administrator
Tuesday, April 6, 2010, 5:34 PM PDT

Yeah, unfortunately, there is very little standards adherence when it comes to mime types for PDF.

The best idea would be for us to update the following lines in QFileAssetBase.class.php:

                case QFileAssetType::Pdf:
                    $this->intFileAssetType = $intFileAssetType;
                    $this->strAcceptibleMimeArray = array(
                        'application/pdf' => 'pdf',
                        'application/octet-stream' => 'pdf'
                    );

What we should be doing is doing a check on Browser Type and setting the AcceptibleMimeArray accordingly.  It's a very tedious task, but it'd be great if someone wanted to take this on.



Copyright © 2005 - 2012, Quasidea Development, LLC
This open-source framework for PHP is released under the terms of The MIT License.