gpt4 book ai didi

ColdFusion 10 cffile 操作 ="upload"接受属性通配符不起作用

转载 作者:行者123 更新时间:2023-12-03 12:45:13 27 4
gpt4 key购买 nike

这段代码过去在 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>

问题是 accept="image/*" cffile 标签的属性。在 ColdFusion 9 中,此通配符用​​于接受 MIME 类型以“image/”开头的任何文件。在 ColdFusion 10 中,我收到以下错误消息:

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



MimeType 值为“image/jpeg”,因此它应该与通配符一起使用。

我看了 wikidocs for the cffile tag它说:

ColdFusion 10: Modifications to the attribute accept}}



但是,它没有详细说明这些修改是什么!

看着 upload action docs ,它表示它将接受逗号分隔的 mime 类型列表。这是否意味着不再接受通配符?

最佳答案

仅供引用,这篇博文在去年同一时间指出了同样的问题:

http://www.cutterscrossing.com/index.cfm/2013/2/21/ColdFusion-10-File-Uploads-and-MIME-Types

Now, I remembered that there were changes to MIME type checking in CF 10, but I wasn't entirely sure. This code, written by one of our developer's several months ago, would allow any "image" MIME type. What we discovered is that we couldn't do this kind of wildcard mapping under CF 10, that we now had to list out each accepted MIME type as a comma delimited list.

关于ColdFusion 10 cffile 操作 ="upload"接受属性通配符不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21897006/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com