ASP要怎么获取上传的二进制数据,然后保存成图片文件!
发布网友
发布时间:2022-04-25 15:55
我来回答
共3个回答
热心网友
时间:2023-10-15 01:37
以下是写入代码
<%
response.buffer=true
formsize=request.totalbytes
formdata=request.binaryread(formsize)
bncrlf=chrB(13) & chrB(10)
divider=leftB(formdata,clng(instrb(formdata,bncrlf))-1)
datastart=instrb(formdata,bncrlf & bncrlf)+4
dataend=instrb(datastart+1,formdata,divider)-datastart
mydata=midb(formdata,datastart,dataend)
set connGraph=server.CreateObject("ADODB.connection")
connGraph.ConnectionString="driver={Microsoft Access Driver (*.mdb)};DBQ=" & server.MapPath("images.mdb") & ";uid=;PWD=;"
connGraph.Open
set rec=server.createobject("ADODB.recordset")
rec.Open "SELECT * FROM aa where id is null",connGraph,1,3
rec.addnew
rec("img").appendchunk mydata
rec.update
rec.close
set rec=nothing
set connGraph=nothing
%>
这是显示代码
<html>
<body>
<center>
<form name="mainForm" enctype="multipart/form-data" action="a1.asp" method=post>
<input type=file name=mefile><br>
<input type=submit name=ok value="OK">
</form>
</center>
</body>
</html>
引用的时候直接这样引用
<input type="image" name="imageField" id="imageField" src="showimg.asp?id=1" />
热心网友
时间:2023-10-15 01:38
以下是写入代码
<%
response.buffer=true
formsize=request.totalbytes
formdata=request.binaryread(formsize)
bncrlf=chrB(13)
&
chrB(10)
divider=leftB(formdata,clng(instrb(formdata,bncrlf))-1)
datastart=instrb(formdata,bncrlf
&
bncrlf)+4
dataend=instrb(datastart+1,formdata,divider)-datastart
mydata=midb(formdata,datastart,dataend)
set
connGraph=server.CreateObject("ADODB.connection")
connGraph.ConnectionString="driver={Microsoft
Access
Driver
(*.mdb)};DBQ="
&
server.MapPath("images.mdb")
&
";uid=;PWD=;"
connGraph.Open
set
rec=server.createobject("ADODB.recordset")
rec.Open
"SELECT
*
FROM
aa
where
id
is
null",connGraph,1,3
rec.addnew
rec("img").appendchunk
mydata
rec.update
rec.close
set
rec=nothing
set
connGraph=nothing
%>
这是显示代码
<html>
<body>
<center>
<form
name="mainForm"
enctype="multipart/form-data"
action="a1.asp"
method=post>
<input
type=file
name=mefile><br>
<input
type=submit
name=ok
value="OK">
</form>
</center>
</body>
</html>
引用的时候直接这样引用
<input
type="image"
name="imageField"
id="imageField"
src="showimg.asp?id=1"
/>
热心网友
时间:2023-10-15 01:38
使用无组件上传类,或者使用组件也可以。
这些网上都可以找到。