ASP文件上传代码
我想在后台添加上传时增加上传文件格式(默认格式只有jpg和gif),我修改了网页代码,但是上传最终失败,图标显示红叉。原代码和修改后代码如下:原代码:
……
if file.FileName<>"" then
Dim getimageExt
Set getimageExt = CreateObject("Scripting.FileSystemObject")
GetAnExtension = getimageExt.GetExtensionName(file.FileName)
if GetAnExtension<>"jpg" and GetAnExtension<>"gif" and GetAnExtension<>"JPG" and GetAnExtension<>"GIF" then
%>
<SCRIPT language=javascript>
alert("文件格式不对,请重新上传");
opener.document.all("id_uploadstr").style.display="none";
window.close();
</SCRIPT>
……
修改后:
……
if file.FileName<>"" then
Dim getimageExt
Set getimageExt = CreateObject("Scripting.FileSystemObject")
GetAnExtension = getimageExt.GetExtensionName(file.FileName)
if GetAnExtension<>"jpg" and GetAnExtension<>"gif" and GetAnExtension<>"swf" and GetAnExtension<>"JPG" and GetAnExtension<>"GIF" and GetAnExtension<>"SWF" then
%>
<SCRIPT language=javascript>
alert("文件格式不对,请重新上传");
opener.document.all("id_uploadstr").style.display="none";
window.close();
</SCRIPT>
……
请问我的修改正确吗,完善吗?若不行,我该怎么做?
[此贴子已经被作者于2007-11-8 18:12:57编辑过]