<cffile.... accept="image/*"....

Ask a Question related to Coldfusion - Advanced Techniques, Design and Development.

  1. #1

    Default <cffile.... accept="image/*"....

    <cffile action="UPLOAD"
    filefield="file_path1"
    destination="#destination#"
    nameconflict="MAKEUNIQUE"
    accept="image/*">


    the code works fine but error is being thrown by coldfusion, i want the error
    to be displayed as a simple error message on my site, I however dont know the
    paremeters to call the error...

    basically i need something simple like... <cfif file is not an image>

    but I am unsure of what variable i would use in the if statements


    anyone know the answer to this?


    davellaman Guest

  2. Similar Questions and Discussions

    1. #39216 [NEW]: call_user_func and friends don't accept array($this, "func") callback anymore
      From: hannes dot magnusson at gmail dot com Operating system: FreeBSD PHP version: 6CVS-2006-10-20 (CVS) PHP Bug Type: ...
    2. Can't locate object method "newFromJpeg" via package "GD::Image"
      Hi. I'm trying to execute this Perl simple script: -------- #!/usr/bin/perl use GD; my $srcimage = GD::Image->newFromJpeg("image_news.jpg");...
    3. CFFILE...nameconflict="makeunique"
      http://www.macromedia.com/cfusion/knowledgebase/index.cfm?event=view&id=KC.tn_16...
    4. Making "unalterable" and "locked" image
      I've noticed some websites have .jpgs that cannot be dragged and copied to someone's desktop. How do I "lock" an image like that? Also, how can I...
    5. #25366 [NEW]: form buttons of type "image" dont send "submit" $_POST variable in IE
      From: jordanolsommer at imap dot cc Operating system: Windows XP PHP version: 4.3.2 PHP Bug Type: Variables related Bug...
  3. #2

    Default Re: <cffile.... accept="image/*"....

    Use cftry and cfcatch. The example will actually catch any error on the upload.

    Your other alternative is to not restrict the upload but then handle any
    extensions that are not OK. eg keep a list of image extensions that are OK.
    After a file is uploaded the following variable 'CFFILE.ClientFileExt' holds
    the files extension. So if it is not in the accepted list then show an error
    and delete the file!!!

    HTH

    <cftry>
    <cffile action="UPLOAD"
    filefield="file_path1"
    destination="#destination#"
    nameconflict="MAKEUNIQUE"
    accept="image/*">

    <cfcatch type="any">
    <h1>This is not an image!</h1>
    </cfcatch>
    </cftry>

    Stressed_Simon Guest

  4. #3

    Default <cffile.... accept="image/*".

    Thanks lot it helped me so much!


    Quote Originally Posted by Stressed_Simon View Post
    Use cftry and cfcatch. The example will actually catch any error on the upload.

    Your other alternative is to not restrict the upload but then handle any
    extensions that are not OK. eg keep a list of image extensions that are OK.
    After a file is uploaded the following variable 'CFFILE.ClientFileExt' holds
    the files extension. So if it is not in the accepted list then show an error
    and delete the file!!!

    <cftry>
    <cffile action="UPLOAD"
    filefield="file_path1"
    destination="#destination#"
    nameconflict="MAKEUNIQUE"
    accept="image/*">

    <cfcatch type="any">
    <h1>This is not an image!</h1>
    </cfcatch>
    </cftry>
    Behnam Aslami Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139