I am trying to create multiple custom file types with the same mime image/*. From all the things I read and the configuration settings I am assuming this is possible and that users can choose which file type they're uploading if the mime type matches multiple file types. For testing I created two custom file types with mime type image/* and uploaded an image. The image took the type of the latest added custom file type. There was no option to select the proper custom type during upload. What am I doing wrong?

I have media 7.x-2.x-dev with bulk upload sub-module installed.

Comments

shadysamir’s picture

Issue summary: View changes
shadysamir’s picture

Leagnus’s picture

Yep, i've got same issue.

IMHO, anybody can create new file type only if mime differs from existing.

dave reid’s picture

Project: File Entity (fieldable files) » D7 Media
Component: Miscellaneous » Media Bulk Upload

I don't believe that the file type selection works with the bulk upload functionality yet, and we don't have a plan in place for supporting it. Assistance for how the UI and workflow for that would work, would be welcome.

nerdoc’s picture

This has nothing to do with bulk upload, as I don't have it installed here, but I have the exact same issue, with a file field in a webform content type.
I have two similar file types with application/pdf MIME type.

I chose "pdf" at the webform as only available file type. When uploading a file on this webform, it is saved, and then listed under admin/content/file as my custom type ("news"), without any chance to influence it.

Then I checked the "normal" file field (without webform). I added a file field to a new content type, and disabled Audio, Video, and my custom PDF type "news" for this file field, only "Document" is allowed. Despite that setting, when uploading a file there, I am asked whether I want to save it as "News" or "Document" from the Media module.

IMHO this is a severe bug. I just don't know of which module ;-) - webform could be the culprit too.

edited (3x) - cleaned up.

nerdoc’s picture

I found it (at least for webform) - webform asks file_entity, exactly using file_get_type() which type the uploaded file is. This function invokes all hook_file_type, and if it is a pdf (in my case) gets an array of 2 types back: array("news", "document").

And then it calls:

return empty($types) ? NULL : reset($types);

Which picks the (randomly) first element of the array and returns it as single item.

The OP wrote about bulk upload, maybe it is similar there.
So, I suppose this is no Media bug...

nerdoc’s picture

This seems to be a file entity bug.

nerdoc’s picture

Status: Active » Closed (works as designed)