求助 这段代码怎么修改文件上传图片大小 要求2M以上
asp吧
全部回复
仅看楼主
level 1
<%
dim arr(3)
dim upload,file,formName,formPath,iCount,filename,fileExt,i
set upload=new upload_5xSoft **建立上传对象
formPath="../upload/" *图片存放的路径:根目录下的ZuoPin文件夹 **在目录后加(/)
**列出所有上传了的文件
for each formName in upload.file
set file=upload.file(formName)
if file.filesize>0 then
if file.filesize>2500000 then
response.write "<font size=2>图片大小超过了限制[<a href=# onclick=history.go(-1)>重新上传</a>]</font>"
response.end
end if
fileExt=lcase(right(file.filename,4))
if fileExt<>".jpg" and fileExt<>".gif" and fileExt<>".bmp" and fileExt<>".png" then
response.write "<font size=2>文件格式限制,仅支持gif,jpg,jpeg,png,bmp[<a href=# onclick=history.go(-1)>请重新上传</a>]</font>"
response.end
end if
end if
NewName = file.FileName
fileNew = mid(NewName, InStrRev(NewName, ".") + 1)
filename=year(now)&month(now)&day(now)&hour(now)&minute(now)&second(now)& "." & fileNew
if file.FileSize>0 then **如果 FileSize > 0 说明有文件数据
file.SaveAs Server.mappath(formpath&filename) **保存文件
*response.write file.FilePath&file.FileName&"("&file.FileSize&") => "&formPath&File.FileName&"上传成功<br>"
response.write "上传成功 <a href=# onclick=history.go(-1)>请返回</a>"
end if
set file=nothing
next
set upload=nothing
Response.Write "<script>parent.add.pic.value=*upload/"&FileName&"*</script>"
%>
2014年09月02日 01点09分 1
level 7
这是服务器限制,不是程序问题。
2014年09月02日 02点09分 2
正解
2014年09月02日 07点09分
已经解决 谢谢
2014年09月04日 02点09分
level 3
在你网站根目录下有个web.config,在里面可以改,
<configuration>
<system.webServer>
<security>
<requestFiltering>
<requestLimits maxAllowedContentLength ="2147483647"></requestLimits>
</requestFiltering>
</security>
</system.webServer>
</configuration>
2014年09月03日 01点09分 3
level 1
问题解决 谢谢
2014年09月04日 02点09分 4
1