100分 求asp上传问题

Iknowurcode 2009-08-05 10:42:01
我写的一个上传方法 上传后
Response.binaryWrite(struploadData) 可以在网页上显示数据并且显示正常,中文也正常

但是写入文件出错,写入文件的方法如下
Set stm = Server.Createobject("Adodb.Stream")
stm.Open
stm.WriteText struploadData
stm.SaveToFile C:\\test.txt,2
WriteFile=True
stm.cancel()
stm.close
set stm = nothing

我发现上传的内容 写入文件后都是2进制,请问如何转换成字符串的形式写入文件啊
...全文
52 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
ouyangzhanbo 2009-08-06
  • 打赏
  • 举报
回复
顶下子啊。。
Iknowurcode 2009-08-06
  • 打赏
  • 举报
回复
谢了 结贴给分 问题解决了
hookee 2009-08-05
  • 打赏
  • 举报
回复


Set stm = Server.Createobject("Adodb.Stream")
stm.Mode = 3
stm.Type =1
stm.Open
stm.Write struploadData
stm.SaveToFile "d:\test1.txt",2
stm.Position = 0
stm.Type= 2
stm.charset = "GB2312"
Response.Write stm.ReadText
stm.close
set stm = nothing
renzaijiang 2009-08-05
  • 打赏
  • 举报
回复
if InStr (45,sInfo,"filename=""",1) > 0 then
set theFile=new FileInfo
'取得文件名
iFindStart = InStr(iFindEnd,sInfo,"filename=""",1)+10
iFindEnd = InStr(iFindStart,sInfo,"""",1)
sFileName = Mid (sinfo,iFindStart,iFindEnd-iFindStart)
theFile.FileName=getFileName(sFileName)
theFile.FilePath=getFilePath(sFileName)
'取得文件类型
iFindStart = InStr(iFindEnd,sInfo,"Content-Type: ",1)+14
iFindEnd = InStr(iFindStart,sInfo,vbCr)
theFile.FileType =Mid (sinfo,iFindStart,iFindEnd-iFindStart)
theFile.FileStart =iInfoEnd
theFile.FileSize = iFormStart -iInfoEnd -3
theFile.FormName=sFormName
if not objFile.Exists(sFormName) then
objFile.add sFormName,theFile
end if
else
'如果是表单项目
tStream.Type =1
tStream.Mode =3
tStream.Open
Data_5xsoft.Position = iInfoEnd
Data_5xsoft.CopyTo tStream,iFormStart-iInfoEnd-3
tStream.Position = 0
tStream.Type = 2
tStream.Charset ="gb2312"
sFormValue = tStream.ReadText
tStream.Close
if objForm.Exists(sFormName) then
objForm(sFormName)=objForm(sFormName)&", "&sFormValue
else
objForm.Add sFormName,sFormValue
end if
end if
文件流和form流读取方式是不一样的 你去下稻香老农无组件上传看下

28,406

社区成员

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

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