日期:2014-05-17  浏览次数:20934 次

asp文件上传出错!!
dim upload,file,formName,formPath,iCount,filename,fileExt,title
set upload=new upload_5xSoft ''建立上传对象
 title=upload.form("title")
 formPath=upload.form("ipath")
 ''在目录后加(/)
shuoming=upload.form("shuoming")
sclass=upload.form("sclass")
if title="" then
response.Write("<script>alert(""产品名称不能为空"");history.back();</script>")
response.End()
end if
 if right(formPath,1)<>"/" then formPath=formPath&"/" 

for each formName in upload.file ''列出所有上传了的文件
 set file=upload.file(formName) ''生成一个文件对象
 if file.filesize<100 then
  response.write "<p align=center><font size=2>请先选择你要上传的文件 [ <a href=# onclick=history.go(-1)>重新上传</a> ]</font></p>"
response.end
 end if
 
 if file.filesize>1024000 then
  response.write "<p align=center><font size=2>文件大小超过了限制 [ <a href=# onclick=history.go(-1)>重新上传</a> ]</font></p>"
response.end
 end if

  我上传大于1M的图片时,不会提示“文件大小超过了限制”,提示“产品名称不能为空”,求解!!!
 fileExt=lcase(right(file.filename,4))

 if fileEXT<>".jpg" and fileEXT<>".gif" and fileEXT<>".bmp" and fileEXT<>".png" and fileEXT<>".swf" then
  response.write "<p align=center><font size=2>文件格式不正确 [ <a href=# onclick=history.go(-1)>重新上传</a> ]</font></p>"
response.end
 end if

------解决方案--------------------
使用:艾恩ASP无组件上传类吧。。
示例又多。调用简单:
http://dev.mo.cn/source_143.html