Closed (duplicate)
Project:
File Entity (fieldable files)
Version:
7.x-2.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
15 Jun 2012 at 12:24 UTC
Updated:
15 Jun 2012 at 15:12 UTC
Jump to comment: Most recent file
Comments
Comment #1
michaelmol commentedPatch attached
Comment #2
michaelmol commentedMy bad, new patch.
Comment #3
slashrsm commented#1292382: Make it possible to create any number of custom File Types will change the way how types are determined for files. Maybe this should be included in that issue?
Comment #4
mauritsl commentedDid you mean file_type_determine() ?
The hook_file_type() is great, but file_type_determine() shows exactly the problem. There can be more than 1 filetype matching the file. We should be able to change that filetype (with file_save()).
This is required for the multi-step upload (#1553114: Adding files should be a multi-step process).
When the file is uploaded it will be automatically registered as a file object by Drupal. There an assumption is already made on the filetype. Thus if you have the bundles "photo" and "logo", it will probably be saved as a "photo". The second step in multi-step upload is asking the correct filetype to the user. The file can then be converted to a "logo" if the user says it's a logo.
This workflow is a bit dirty. Maybe new files should be saved with an "undefined" type first, before setting the correct type. Anyway.. The new hook is not a complete solution for this. This bug is still valid.
Comment #5
slashrsm commentedI do not state that file_type_determine() does the job. It is just a suggestion. My point in #3 was, that patches in #1292382: Make it possible to create any number of custom File Types already totally change the code, which is discussed in this issue. That's why I think we should mark this as duplicate and keep this debate going on in that issue.
You have a good point in #4, but we should discuss things in one place.
Comment #5.0
slashrsm commentedrevisted description