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

Processing uploaded files

Enthusiast ,
Feb 01, 2008 Feb 01, 2008

Copy link to clipboard

Copied

I need to upload photos to a site, I want to make sure that they are only JPG files uploaded, plus restrict the size.

Is there anyway to check the filesize and type before uploading? Or can somebody upload a 20meg EXE file that would hog our bandwidth?

Also, how do I check the file extension to make sure it's JPG? When I look at it I get TMP, and if I save it I seem to have to specify an extension?

Thanks

Mark
TOPICS
Advanced techniques

Views

183

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
Explorer ,
Feb 04, 2008 Feb 04, 2008

Copy link to clipboard

Copied

LATEST

Hello,

Using ColdFusion by itself you can not determine the size of the file until after it's uploaded. Also there is nothing that would prevent a person from renaming a file from .exe to .jpg and getting around any restriction that you may have on the client with javascript.

To prevent someone from uploading a file that is greater than a set limit you will need to use either Flash or a Java Applet. With either or those two options they can check the file size and or file type (by inspecting the file header) and allow or disallow the file upload.

There are a number of free/shareware java and/or flash upload utilities where you can set limits. The target of the upload can still be a cfm template.

Regards,

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