asp问题----下面这断代码有无错

来源:百度知道 编辑:UC知道 时间:2024/06/28 09:32:40
<body>
<%
if request.QueryString("query")<>"test" then
%>
<form action="?query=text" method="post" enctype="multipart/form-data" name="form1" id="form1">
<input type="file" name="file" >
<input type="submit" name="submit" value="提交"/>
</form>
<%
else
response.ContentType="image/jpeg"
data=request.BinaryRead(request.TotalBytes)
tcrlf=chrb(13)&chrb(10)
flag=leftb(data,instrb(data,tcrlf)-1)
datastart=instrb(data,tcrlf & tcrlf)+4
datalength=instrb(datastart+1,data,flag)-datastart
response.BinaryWrite midb(data,datastart,datalength)
end if
%>
</body>

ContentType 是写在头信息 <head></head> 之间的;你用 Response.ContentType ="image/jpeg" 时,ASP.DLL 已经将 HTML 头信息写好了:
<HTML>
<HEAD>
<META HTTP-EQUIV="ContentType" CONTENT="image/jpeg">
</HEAD>
</HTML>

并且在重复的情况下,第一了为准