图片上传为什么不成功,提示出错:asp 80004005
tonl8 2004-02-06 06:32:47 这个是我的代码,各位老兄,帮我改改,请帮我解释一下每句的作用,我实在是搞不清为什么不成功啊,急!
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文档</title>
</head>
<body>
<%dim getbyte
getbyte=request.TotalBytes
response.Write(getbyte)%>
<%=request.BinaryRead(getbyte)%>
<%
Dim myconn,connstr
connstr = "Provider=Microsoft.Jet.Oledb.4.0;data source="&Server.MapPath("Upload.mdb")
set myconn = Server.CreateObject("adodb.connection")
myconn.open connstr
Function Myrequest(fldname)
''取表单数据
''支持对同名表单域的读取
dim i
dim fldHead
dim tmpvalue
for i = 0 to loopcnt-1
fldHead = fldInfo(i,0)
if instr(lcase(fldHead),lcase(fldname))>0 then
''表单在数组中
''判断该表单域内容
tmpvalue = FldInfo(i,1)
if instr(fldHead,"filename=""")<1 then
Tmpvalue = Bytes2bStr(tmpvalue)
if myrequest <> "" then
myrequest = myrequest & "," &tmpvalue
else
MyRequest = tmpvalue
end if
else
myrequest = tmpvalue
end if
end if
next
end function
Sub SaveToFile(fd,path,fname)
''保存文件''参数说明:''fd:byte()类型数据,文件内容''path:保存路径后面必须带"/"''fname:文件名
dim Fstream
Set FStream = Server.CreateObject("adodb.stream")
fstream.mode = 3
fstream.type = 1
fstream.open
fstream.position = 0
fstream.Write fd
fstream.savetofile Server.Mappath(path&fname),2
fstream.close
set fstream = nothing
end sub
%>
<%=request("url")%>
<%=lenb(myrequest("filename"))%>
<form action="check.asp" method="post" enctype="multipart/form-data" name="form1">
<input name="filename" type="file" id="filename">
<input type="submit" name="Submit" value="提交">
</form>
<%if request.form("filename")<>"" then
fd=myrequest("filename")
path="./uploadfile/"
savafilename="ddd.jpg"
'call savetofile(fd,path,savafilename)%>
<%end if
%>
</body>
</html>