asp单独接收post数据报"internal server error"

[size=12px]本人对asp了解不深,只是工作需要,要有一个服务端负责接收文件并保存在服务端
有这样一段代码upload.asp
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文档</title>
</head>
<body>
<%
'On Error Resume Next
Response.Expires=0
if Request.TotalBytes then 
set a=createobject("adodb.stream")  
a.Type=1  
a.Open  
a.write Request.BinaryRead(Request.TotalBytes)  
a.Position=0  
b=a.Read  
c=chrB(13)&chrB(10)  
d=clng(instrb(b,c))  
e=instrb(d+1,b,c)  
set f=createobject("adodb.stream")   
f.type=1   
f.open   
a.Position=d+1   
a.copyto f,e-d-3   
f.Position=0   
f.type=2   
f.CharSet="GB2312"   
g=f.readtext   
f.Close   
h=mid(g,instrRev(g,"\")+1,e)   
i=instrb(b,c&c)+4   
j=instrb(i+1,b,leftB(b,d-1))-i-2   
if j <1 then    
set f =nothing    
set a =nothing    
response.write "未选择要上传的文件<a href='?'>重新上传</a>"    
response.end   
end if   
f.Type=1   
f.Open 
a.Position=i-1   
a.CopyTo f,j   

h = Mid(h, InStrRev(h, "filename=""") + 10) '这是我帮你添加的,文件名的获取没有正确 
'f.SaveToFile server.mappath("..\"& h),2 
f.SaveToFile server.mappath(h),2
f.Close  
set f=Nothing 
a.Close 
set a=Nothing 
'response.write "<a href="&Server.URlEncode(h)&">"&h&"</a>"
end if
If Err.number<> 0 Then
  response.Write err.number
  response.Write err.Description
  Response.End
  End If
%>

另外还有一个submit.html,代码为
<html><title>example</title>
<body>
<form name="form1" method="post" action="upload.asp" enctype="multipart/form-data">
<input type=file name="file1">
<input type=submit name="submit" value="提交">
</form>
</body> 
</html>

问题来了,当在浏览器里访问submit.html,是可以上传文件的.
但是直接用客户端的程序访问upload.asp,发送post数据,asp服务器端会返回internal server error的错误,这是为什么呢???
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值