1

I have a file upload field that we have restricted to only the certain types of files we allow. However, we have recently needed to add the .dcm file type to this allowance. The MIME type I can find that seems to be connected to these files, application/dicom, isn't allowing for file browsing to pick up this file type.

Has anyone had any luck in adding this particular file type to their file uploads?

edit: Attempts such as *.dcm, image/dcm, image/x-dicom, and any similar MIME types did not prove to allow this particular file extension, either.

Hitokage
  • 201
  • 2
  • 12
  • If the user does not have that MIME type registered, it won't know what to do with it. You can try using the extension in the `accept` attribute (from [How to allow to accept only image files?](https://stackoverflow.com/q/3828554/215552)) – Heretic Monkey Sep 09 '20 at 20:03
  • @HereticMonkey, I attempted image/dcm, even image/*, but since it's not a recognized image type, it doesn't work. The thing is that application/dicom IS a registered MIME type, which is why I'm puzzled as to why application/dicom isn't working like I would expect, but I see at least one other file upload out there with limited upload types able to upload .dcm files. There must be some way. – Hitokage Sep 10 '20 at 12:36
  • Did you try `"*.dcm"`? That's what I meant by extension... – Heretic Monkey Sep 10 '20 at 12:41
  • Unfortunately, *.dcm did not work, either. – Hitokage Sep 10 '20 at 13:12

2 Answers2

4

The answer was a little late, but I succeeded with the following attempt

<input type="file" accept="*/dicom,.dcm, image/dcm, */dcm, .dicom"/>
Anteater99
  • 66
  • 2
0

Since it cant be commonly displayed by a browser its not possible to allow that extension.

The octet-stream format is used for file attachments on the Web with an unknown file type and DICOM identifies itself as octet-stream (Content-Type: application/octet-stream), a workaround would be to add the MIME type as octet-stream.