Skip to main content
Participant
July 19, 2007
Question

MIME Type Check for file upload

  • July 19, 2007
  • 1 reply
  • 444 views
Hello!

I'm working on a multi-file upload application for a client. I need to check file size and file MIME type as part of the validation process.

File size check...easy...that's working fine.

File MIME type, it seemed to be working properly in Firefox but not in Internet Explorer.

I cannot seem to figure out the best cross-browser method to validate MIME type for files being uploaded.

I am using CFFILE to upload the files to a temp directory first. I do have the "accept" attribute currently set and am using a <cfcatch type="application"> around the validation code.

Are there any dependable cross-browser methods (built-in tag or function, custom tag, cfscript, etc) to check file MIME type for files being uploaded through an upload form?

Thank you for any assistance that can be provided!

Best,
Tony, Freelance Web Developer
This topic has been closed for replies.

1 reply

Inspiring
July 19, 2007
You could try using listlast() on the file name.
Participant
July 20, 2007
ListLast() would help me check the file extension but not the MIME type. I'm trying to make this as secure as I can, if possible.

Thanks,
Tony