asp上传问题?

雪克 2010-07-01 02:31:39
我用下面代码上传一个文件大于1M就不能上传了,请大哥们,帮看看怎么该才能上传一个大的文件?谢谢!
<%
dim upload,file,formName,formPath,filename,fileExt
set upload=new upload_5xSoft ''建立上传对象

'设置区
'==========================================================
formPath=GetSysInfo("SaveUpFilesPath") '文件保存路径
MaxFileSize=GetSysInfo("MaxFileSize") '单位KB,0为无限
UpFileType=GetSysInfo("UpFileType") '文件类型,空串为无限
if right(formPath,1)<>"\" then formPath=formPath & "/"

Incept= upload.form("UP_incept")
Methods=upload.form("UP_methods")

for each formName in upload.file ''列出所有上传了的文件
set file=upload.file(formName) ''生成一个文件对象
if file.filesize<0 then
response.write "<font class=14p>请先选择你要上传的文件 [ <a onclick=history.go(-1) style='cursor: hand' class=14p>重新上传</a> ]</font>"
response.end
end if

if file.filesize>(MaxFileSize*1048576) then
response.write "<font class=14p>文件大小超过了限制 "&CStr(MaxFileSize)&"K [ <a onclick=history.go(-1) style='cursor: hand' class=14p>重新上传</a> ]</font>"
response.end
end if

fileExt=lcase(mid(file.filename,instrrev(file.filename,".")+1))

arrUpFileType=split(UpFileType,"|")
for i=0 to ubound(arrUpFileType)
if fileEXT=trim(arrUpFileType(i)) then
EnableUpload=true
exit for
end if
next
if fileEXT="asp" or fileEXT="asa" or fileEXT="aspx" then
EnableUpload=false
end if
if EnableUpload=false then
response.write "<font class=14p>只允许上传:" & UpFileType &" 文件类型 [ <a onclick=history.go(-1) style='cursor: hand' class=14p>重新上传</a> ]</font>"
response.end
end if

filename=formPath & GetFileName(fileExt)


if file.FileSize>0 then ''如果 FileSize > 0 说明有文件数据
file.SaveAs Server.mappath(FileName) ''保存文件
call EndUp()
end if
set file=nothing
next
set upload=nothing ''删除此对象
response.write("<script>parent.document.forms[0].Submit.disabled=false;parent.document.forms[0].Submit2.disabled=false;</script>")
Sub EndUp()
'上传文件结束
Methods=lcase(Methods)
ServerFileName=replace(FileName,"\","\\")
select case Methods
case "one"
response.write "<script>parent.document.form1." & Incept & ".value='" & ServerFileName &"'</script>"
case "more"
response.write "<script>parent.document.form1." & Incept & ".value+='" & "!" & ServerFileName &"'</script>"
case "_image"
response.write "<script>parent.WBTB_Composition.document." & Incept & ".innerHTML+='<br><img border=0 src="& ServerFileName &">'</script>"
case "_link"
response.write "<script>parent.WBTB_Composition.document." & Incept & ".innerHTML+='<br><a href="& ServerFileName &"><img border=0 src=image/"&FileEXT&".gif>点击下载浏览该文件"& ServerFileName &"</a>'</script>"
case "_flash"
response.write "<script>parent.WBTB_Composition.document." & Incept & ".innerHTML+='<embed src=" & ServerFileName & " quality=high pluginspage=http://www.macromedia.com/go/getflashplayer type=application/x-shockwave-flash width=337 height=191>'</script>"
response.write "<script>parent.WBTB_Composition.document." & Incept & ".innerHTML+='</embed>'</script>"
case "_define"
case else
response.write("OK")
end select
response.write "<script>parent.document.form1.IncFiles.value+='" & "!" & ServerFileName &"'</script>"
response.write("<a style='cursor: hand' class=14p onclick=""history.back()"">上传成功 返回</a>")
End Sub
Function GetFileName(strFileExt)
'构造服务器端的保存文件名
set FSO=server.CreateObject("scripting.FileSystemObject")
strTempName=year(now) & right("00" & month(now),2)
strTempName=strTempName & right("00" & day(now),2)
strTempName=strTempName & right("00" & hour(now),2)
strTempName=strTempName & right("00" & Minute(now),2)
strTempName=strTempName & right("00" & second(now),2)
for SN=1 to 9999
if not FSO.FileExists(formPath & strTempName & SN & "." & strFileExt) then
exit for
end if
next
set FSO=nothing
GetFileName=strTempName & right("0000" & SN,4) & "." & strFileExt
End function
%>
...全文
82 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复

16,550

社区成员

发帖
与我相关
我的任务
社区描述
VB技术相关讨论,主要为经典vb,即VB6.0
社区管理员
  • VB.NET
  • 水哥阿乐
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧