Closed (works as designed)
Project:
File Framework
Version:
6.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
20 Mar 2009 at 21:01 UTC
Updated:
12 Dec 2011 at 16:15 UTC
Comments
Comment #1
justin.hopkins commentedHey there. Fileframework should be using mime types to "recognize" files of different types.
Whether or not it can perform any actions on the file(s) would have to do with the ability/availability of tools to work on them - for instance it can only convert a pdf to plain text if you have the pdftotext utility installed on your system.
I've had issues with mime type recognition and webdav, but if you are uploading via web browser - the default settings are that Fileframework will get mime type info from you (your browser).
Look at admin/settings/file/mime - is pdf listed there?
If you are using webdav - and even if not, I've got an issue open #406182: Is it possible to rebuild file types (mime.types)? which is somewhat related...I'm trying to figure out how to get Fileframework to take another look at files which have already been added.
I am able to upload pdfs and dwf's without issue, it properly recognizes .dwf as model/vnd.dwf although fileframework doesn't do anything special with dwf's....you can download them :)
Hope that helps.
Comment #2
visualnotion commentedThanks for the reply, Justin.
I've checked at the URL you referenced and PDF isn't anywhere in that list. Yes, we are uploading through the browser, at this point.
Any thoughts on how to add PDF to the list of mime types?
Comment #3
visualnotion commentedI have checked in Cpanel and the mime types listed there does list PDF. There just seems to be a disconnect somewhere between that and Fileframework.
Comment #4
justin.hopkins commentedYou *might* try setting 'Server-side MIME type autodetection after upload' to 'Enabled' at admin/settings/file, but I haven't had much luck with that setting myself.
How this module handles MIME data isn't something I understand very well, so hopefully miglius will chime in on this soon.
Comment #5
miglius commentedHere is how it works in the following steps:
1. File arrives with the MIME type sent by the browser which has uploaded the file.
2. If the MIME is missing or if it is unrecognized ('application/octet-stream'), then the MIME is guessed by the file extension using the mime.types file for the mapping.
3. If Server-side MIME type autodetection is enabled or set to conditional, the system does not trust the mime type the file has so far and MIME is being redetected on the server using php fileinfo extension or shell 'file' command.
The server side detection is used to avoid situations when a browser sends a wrong MIME type and a user has renamed the file by adding a false extension. This situation means that a wrong file conversion utilities would be used to build a derivative files. From my experience though, the fileinfo extension fails to correctly detect some mime types and therefore should be used with caution.
I'm planning to step away from the mime.types file and use more flexible and configurable mapping, see #282955: Use other file MIME detection instead of the mime.types file.
Comment #6
visualnotion commentedThanks for the replies.
Miglius, when these changes are made in the settings, does this affect ALL current attached files or only new ones uploaded/attached after the settings are changed?
I'll see about trying the setting you mentioned in 3) on your list above, again.
Comment #7
miglius commentedThe changes will affect only new files, but I see your point. If the file is already uploaded and them MIME is wrong, after changing the MIME table one has to reupload the file to set the proper MIME.
The redetection of MIME for currently uploaded files could be implemented, but I would need to think more what would be better - to do it per individual file, or should the script redetect MIMEs for all uploaded files in the system, which can be process intensive, since if on server autodetection is enabled, the file should be pulled from the bitcache, the MIME redetected and all new file conversions run again.
Comment #8
visualnotion commentedI was able to get PDFs working by adding this to the file_document.module in the file_document_mime_types() function:
Is there a reason why this couldn't be included in the module for future releases?
I do recognize the complexity of the auto-update process and appreciate your willingness to work on it further. I'll keep an eye on future updates and these issues, though as I am interested in using fileframework on other projects as well.
Comment #9
miglius commentedThe way a MIME type is recognized has been changed drastically recently as of #282955: Use other file MIME detection instead of the mime.types file. Can you test the latest code to see if it solves the issue?
Comment #10
ZyanKLee commentedI had a test on this: it works only with visualnotion's modification on the current dev version.
In addition I managed to get ff to convert pdf to txt (and zip) as well:
add this to the same file (file_document.module) to the end of the
function file_document_mime_converters()around line 200:One flaw: this does NOT ocr any image that may be in your pdfs, but just extracts text.
Comment #11
jvieille commentedNot sure what this issue is about.
pdf are well recognized and converted. See for example
http://web2.see.asso.fr/en/node/1922
Comment #12
johanneshahn commentedhi ZyanKLee,
this lines of code already in
/formats/slideshow/file_slideshow.module
near line 100:
and in
/formats/archive/file_archive.module
near line 113:
i think the problem was in older fileframework 6.x-1.0-alpha3
u only need to install the file_slideshow and file_archiv module
then the application/pdf appears in mime list (/admin/settings/file/mime) and as
converter (/admin/settings/file/convert/converter)