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

asp上传图片问题,请高手解决

sxmqiuhan 发布于 2010-11-15 15:37, 413 次点击
页面老是弹出
只有本站会员才能查看附件,请 登录

这不是图片大小超过的问题,无论传什么图片都不行,我之前没学过asp,求高手解决!
-----upload.asp页面-------
<% img=Request("img")
imgnumber=Request("imgnumber")
img=Request("img")

if img<>"" then
 imgurl=img
else
 imgurl=systempath&"images/0.gif"
 end if

if Request("showimg")<>"" then
  imgurl=Request("showimg")
end if

%>
<html><title>example</title>
<LINK href="../../inc/Style.css" rel=stylesheet>
<body leftmargin="0" topmargin="0" bgcolor="#F0F0F0" >
<table width="100%" border="0" cellspacing="0" cellpadding="0">
  <form name="form1" method="post" action="upfile.asp" enctype="multipart/form-data"> <tr>
      <input type="hidden" name="imgnumber" value="<%=Request("imgnumber")%>">
      <td height="35" valign="top">
        <input type=file name="file1">
        <input type=submit name="submit" value="提交">
        <input type="hidden" name="imgxz" value="<%=Request("img")%>">
        图片尺寸(270*210)</td>
    </tr></form>
  </table>

</body>
</html>

--------upfile.asp---------
<body>
<!--#include FILE="upload_5xsoft.inc"-->
<%
  set upload=new upload_5xsoft  ''建立上传对象
  set file=upload.file("file1") ''生成一个文件对象
  imgxz=upload.Form("imgxz")
  imgnumber=upload.Form("imgnumber")
  formPath=picpath&Session("kind")  
  fileExt="."&right(file.FileName,3)
  
 savename=imgnumber&imgxz&fileExt
 file.saveAs Server.mappath(formPath&savename)
if file.FileSize>200000 then
 %>

<script>
alert('对不起,图象大小不能超过200000字节!');
history.back();
</script>

<%end if

if file.FileSize>0  then

%>
 <script>  
   parent.house.<%=imgxz%>.value="<%=formPath%><%=savename%>";   
   parent.house.imgarea.src="<%=formPath%><%=savename%>";  
 </script>


<%  
else
  response.write "<script>alert('注意!您上传了空文件');history.go(-1)</script>"
end if

set file=nothing
set upload=nothing
%>
<script>
window.location.href='upload.asp?imgnumber=<%=imgnumber%>&showimg=<%=formPath%><%=savename%>';
</script>
</body>
</html>

1 回复
#2
dzt00012010-11-15 18:22
if file.FileSize>200000 then
把数值改大
1