1 Reply Latest reply on Feb 4, 2008 1:50 AM by garyrgi

    Processing uploaded files

    ACS LLC Level 1
      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?


        • 1. Re: Processing uploaded files
          garyrgi Level 1


          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.