Skip to main content
Participating Frequently
July 15, 2010
Question

To Make Blacklist While Uploading File

  • July 15, 2010
  • 1 reply
  • 1519 views

Hi,

I want to make a blacklist while uploading file.

I can make whitelist by using <cffile accept="image/*". But i want to make a blacklist (dontaccept="*.cfm,*.asp,*.php").

How can i do this ?

Can you help me pls

    This topic has been closed for replies.

    1 reply

    Inspiring
    July 15, 2010

    You can do two things.

    1. Use the accept attribute of CFFILE to limit the MIME types to images.  Use this with caution.  A malicous user could supply an incorrect MIME type to upload a .exe file with a MIME type of "image/png".

    2. Check the uploaded file's extension using the cffile.serverFileExt value created by CFFILE.

    CFFILE documentation:

    http://help.adobe.com/en_US/ColdFusion/9.0/CFMLRef/WSc3ff6d0ea77859461172e0811cbec22c24-738f.html

    Pete Freitag has some information about this topic on his blog.

    http://www.petefreitag.com/item/701.cfm

    NDemirxAuthor
    Participating Frequently
    July 15, 2010

    Thank you.


    Okay, but if they change ext file as they want, they again can upload a file.

    I want a control using metadata.

    So how can i read metadata of a file ?

    Inspiring
    July 15, 2010

    What metadata are you trying to get, can you provide a specific list? Bear in mind that you will not be able to read a file on the server until after it has been uploaded.