<...">

ColdFusion 10 cffile action = "load" wildcard flag not working

This code works fine with ColdFusion 9:

<cfif form.btnSaveImage EQ "Upload">
    <cftry>
        <cffile accept="image/*" action="upload" destination="C:\T" filefield="vcImageFile" nameconflict="overwrite">
        <cfcatch type="Any">
            <cfdump var="#cfcatch#" label="cfcatch">
        </cfcatch>
    </cftry>
</cfif>

<form action="<cfoutput>#cgi.SCRIPT_NAME#</cfoutput>" method="post" name="frmImagesAdd" id="frmImagesAdd" enctype="multipart/form-data">
    <label for="vcImageFile">Image File*:</label><br>
    <input type="file" name="vcImageFile" id="vcImageFile" size="40" maxlength="255" message="Image file is required to upload."><br>
    <input type="hidden" name="btnSubmit" value="Add Image">
    <input name="btnSaveImage" type="submit" value="Upload">
</form>

The problem is the accept="image/*"cffile tag attribute. In ColdFusion 9, this pattern is used to accept any file with a MIME type that begins with "image /". In ColdFusion 10, you receive the following error message:

"The MIME type or file extension of the uploaded file / jpeg was not accepted by the server."

The value of MimeType is "image / jpeg", so it should work with a wildcard.

I looked at wikidocs for the ciffile tag and it says the following:

ColdFusion 10: accept attribute changes}}

However, he does not specify what these changes are!

docs, , mime -. , ?

+4
1
+1

Source: https://habr.com/ru/post/1527814/


All Articles