【发布时间】:2011-02-22 00:46:23
【问题描述】:
我正在使用带有 accept 属性的 cffile 标记。如果用户上传的 mime 类型不是我允许的,我想阻止它,但同时我希望能够处理错误。我尝试使用 try catch 块,但仍然出错。
<cftry>
<cffile action="upload"
filefield = "txtImg"
accept="image/jpeg, image/png, image/bmp, image/gif, image/pjpeg, image/x-png"
destination="E:\www2\website\Home\uploads\Images\"
nameconflict="makeunique">
<cfcatch>
<script>
$(function(){
alert("Only the following file types are allowed: .jpg, .gif, .bmp, .png.");
});
</script>
</cfcatch>
</cftry>
【问题讨论】:
-
你说它仍然错误,但你收到的错误文本是什么?
标签: coldfusion