注册 登录
编程论坛 ASP技术论坛

ASP文件上传代码

jm117 发布于 2007-11-08 18:12, 610 次点击
我想在后台添加上传时增加上传文件格式(默认格式只有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编辑过]

1 回复
#2
永夜的极光2007-11-08 18:25
你显示的地方是怎么写的呢?如果还是用img,是不可能显示flash的

[此贴子已经被作者于2007-11-8 18:25:39编辑过]


1