Forums / Setup & design / Not able to download pdf files from Media

Not able to download pdf files from Media

Author Message

Iain MacLean

Monday 26 January 2004 5:04:39 pm

Hi

I'm having trouble getting ezpublish-3.3-2 to find PDF files after I upload them into the Media folder or a file library section I have created in the Content area. I can upload MSOffice and OpenOffice docs and spreadsheets OK, and they can be downloaded, but I can't download PDF files. A link to a pdf file appears in the correct node (with the correct file name, but 0kb as the size) and there is a copy of the file in /var/site_dirctory/storage/original/text.

However, when I try to download it, it get an "Object is unavailable" error.

I have checked the permissions on the folders and they are OK (as I can upload, I guess that's obvious).

If I re-name a pdf and give it a *.doc or *.sxw extension before uploading it, everything works properly.

I had the same problem with eZpublish-3.3-1.

I had thought it might be an Apache mime handling problem. I inserted a new AddType application/pdf in the httpd.conf, but that didn't work, either.

I'm guessing it's got something to do with eZpublish not recording the new file name of the pdf in the /var directory so that it can retrieve it later, but I have no idea where to start if that is the case.

It's got me stumped!

Anyone have any bright ideas?

Iain MacLean

Iain MacLean

Thursday 29 January 2004 12:11:48 am

Still don't have a solution to this, although it appears that eZpublish is interpreting the mime type application/pdf as text/pdf, which is why it stores PDF files in /var/site_directory/storage/original/text instead of /var/site_directory/storage/original/application. If I copy the newly uploaded PDF into /var/site_directory/storage/original/application, then I can download it. Postscript files are correctly stored in /var/site_directory/storage/original/application, and text files are stored in /var/site_directory/storage/original/text. I can download both from their respective directories.

It seems that the files ezbinaryfiletype.php and ezmimetype.php are the ones that control this process, especially the functions in ezmimetype.php, possibly using the array var $QuickMIMETypes = array() at the bottom of ezmimetype.php. However, that doesn't explain why PDF files end up interpreted as text/pdf rather than application/pdf.

Direct download PDF export works OK, although if I don't export for direct download I get a error "You don't have permission to access /var/site_directory/storage/pdf/file.pdf on this server". The newly-created PDF file is stored in /var/site_directory/storage/pdf (as it is supposed to be), and apache has all the required permissions, but I still can't download it.

I do not have pstotext installed on my server or development machine (both Linux), but I do have pdftotext installed. Could that be a possible cause?

The file library is an important part of my client's site, so I would be really, really grateful of any suggestions as to the possible cause of the problem.

Iain

Iain MacLean

Saturday 31 January 2004 6:44:42 pm

Problem sorted. It seems to be caused by the way Opera handles the mime type of PDF files. When I tried uploading PDF files with another browser it worked fine. Both Firebird and IE6 put the PDF file in the correct directory for download. Should have tried this earlier :-(.

I've seen some posts about how Netscape handles PDF files when downloading. Perhaps this is relelated?

Cheers

Iain