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

工程师123123123 2014-11-03 09:49:22
[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的错误,这是为什么呢???
...全文
214 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
工程师123123123 2014-11-07
  • 打赏
  • 举报
回复
自己解决了,感谢大家
工程师123123123 2014-11-05
  • 打赏
  • 举报
回复
引用 3 楼 slwsss 的回复:
post 有提交数据吗
提交数据了 我直接编程提交的,提交的数据我抓了一下包 POST /apple/upload.asp HTTP/1.1Host: 192.168.3.60Content-Type: multipart/form-data; boundary=itcastConnection: keep-aliveAccept: */*User-Agent: uploadfile3/1 CFNetwork/711.0.6 Darwin/13.3.0Content-Length: 193Accept-Language: en-usAccept-Encoding: gzip, deflate--itcast Content-Disposition: form-data; name="uploadFile"; filename="1.txt" Content-Type: text/plain this is content.--itcast Content-Disposition: form-data; name="submit" Submit --itcast-- 其中“--itcast”是边界 “this is content.”是传递的数据内容,我就是想把这个传到服务器上新建一个文件把它保存下来 请问错在什么地方啊,服务器报错“internal error”
slwsss 2014-11-04
  • 打赏
  • 举报
回复
post 有提交数据吗
snlixing 2014-11-04
  • 打赏
  • 举报
回复
将iis7中ASP模块里面的“将错误发送到浏览器”改成True
工程师123123123 2014-11-03
  • 打赏
  • 举报
回复
没人帮忙看看吗?? 给点意见也行啊

28,391

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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