• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

CF9 cffile upload and mimetypes

LEGEND ,
Dec 28, 2012 Dec 28, 2012

Copy link to clipboard

Copied

Hello, everyone.

According to the CFML Ref for CFFILE/UPLOAD, "The browser uses the file extension to determine file type."

We all know that this isn't the most secure way of determining a file mimetype.  Has anyone discovered or invented a way to have CF Server actually look at the code of the file being uploaded to determine the mimetype?

Thanks,

^_^

Views

974

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
Dec 28, 2012 Dec 28, 2012

Copy link to clipboard

Copied

This doesn't help you with CF9, but CF10 does examine file headers to confirm mimetype.

-Carl V.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Dec 28, 2012 Dec 28, 2012

Copy link to clipboard

Copied

I'm hoping that someone wrote a CFC/UDF that will do the same thing in CF9. 

Haven't found it, yet.

Thank you,

^_^

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Jan 02, 2013 Jan 02, 2013

Copy link to clipboard

Copied

Did you check riaforge.org?

They have a function called Magic Mime:  http://magicmime.riaforge.org/ 

Similar to how Linux/Unix check the contents of a file to determine their type, instead of using the file extension, this CF function performs a similar task.

Simple CFFUNCTION that returns a structure detailing the filetype/mimetype etc.

Currently supports:-

Adobe PDF Document

Microsoft Office Open XML Format Document

Microsoft Office Open XML Format Spreadsheet

Microsoft Office Open XML Format Presentation

Microsoft Office Word 97-2003 Document

Microsoft Office Excel 97-2003 Document

Microsoft Office Powerpoint 97-2003 Document

Graphics interchange format Image

Portable Network Graphics Image

JPEG Image

HTML (Experimental)

HTML (Experimental)

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jan 03, 2013 Jan 03, 2013

Copy link to clipboard

Copied

Thanks for the heads-up, Tim.  I'll look into it, and try to get the decision-maker to d/l and put it where us developers can reach it.

^_^

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jan 03, 2013 Jan 03, 2013

Copy link to clipboard

Copied

LATEST

Unfortunately, Wordpress is blocked by my network admins, so I can't download it.  But thank you for the suggestion.

^_^

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation