ASP要怎么获取上传的二进制数据,然后保存成图片文件!
PHP通过file_get_contents("php://input")来获取上传的二进制数据,再使用file_put_contents(SD_ROOT.'./'.$n...
PHP通过file_get_contents("php://input")来获取上传的二进制数据,再使用 file_put_contents(SD_ROOT.'./'.$new_avatar_path,file_get_contents("php://input")); 就可以写入目录文件内容
ASP要怎么获取上传的二进制数据,然后保存成图片文件!
一楼的看清楚问题哈:然后保存成图片文件!不是要存到数据库。是要保存成图片文件存到文件夹的 展开
ASP要怎么获取上传的二进制数据,然后保存成图片文件!
一楼的看清楚问题哈:然后保存成图片文件!不是要存到数据库。是要保存成图片文件存到文件夹的 展开
3个回答
展开全部
以下是写入代码
<%
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" />
<%
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" />
展开全部
以下是写入代码
<%
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"
/>
<%
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"
/>
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
使用无组件上传类,或者使用组件也可以。
这些网上都可以找到。
这些网上都可以找到。
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询