ASP程序限制上传图片类型和大小
<%setupload=newupload_hizisetfile=upload.file("file1")id=upload.form("id")fileExt=lca...
<%
set upload=new upload_hizi
set file=upload.file("file1")
id = upload.form("id")
fileExt=lcase(right(file.filename,3))
if Instr(","&UpFileLeis&",",","&fileExt&",")=false then
%>
<script language="VBScript" type="text/VBScript">
msgbox "文件类型不符要求,请重新选择合适类型进行上传!"
history.back(1)
</script>
<%
response.end
end if
%>
<%
if file.filesize>UpFileSize*1024*1024*8 then
%>
<script language="VBScript" type="text/VBScript">
msgbox "图片大小超出限制,请重新选择上传!"
history.back(1)
</script>
以上是程序好像不完整,想限制上传图片类型为JPG和GIF,大小1m,请帮助完善并说明 展开
set upload=new upload_hizi
set file=upload.file("file1")
id = upload.form("id")
fileExt=lcase(right(file.filename,3))
if Instr(","&UpFileLeis&",",","&fileExt&",")=false then
%>
<script language="VBScript" type="text/VBScript">
msgbox "文件类型不符要求,请重新选择合适类型进行上传!"
history.back(1)
</script>
<%
response.end
end if
%>
<%
if file.filesize>UpFileSize*1024*1024*8 then
%>
<script language="VBScript" type="text/VBScript">
msgbox "图片大小超出限制,请重新选择上传!"
history.back(1)
</script>
以上是程序好像不完整,想限制上传图片类型为JPG和GIF,大小1m,请帮助完善并说明 展开
2个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询