我正在上传图片.上传图片时,我将图片名称和该文件的链接保存在一个文本文件中.
喜欢这个,
abc.jpeg,HTTP://google.com
喜欢这个,
abc.jpeg,HTTP://google.com
我该怎么做?
请帮忙.
我用过这个asp代码:
<% For Each FileName in fold.Files Dim Fname Dim strFileName Dim objFSO Dim objTextFile Dim URLString Dim strReadLineText Fname= mid(FileName.Path,instrrev(FileName.Path,"\\")+1) strFileName = "../admin/Links.txt" Set objFSO = Server.CreateObject("Scripting.FileSystemObject") Set objTextFile = objFSO.OpenTextFile(Server.MapPath(strFileName)) URLString="" Do While Not objTextFile.AtEndOfStream strReadLineText = objTextFile.ReadLine 'response.Write(strReadLineText & "<br>") If strReadLineText<>"" then If Instr(strReadLineText,",")>0 then strReadLineTextArr=split(strReadLineText,") response.Write(strReadLineTextArr(0)) URLString=strReadLineTextArr(1) end if end if Loop ' Close and release file references objTextFile.Close Set objTextFile = Nothing Set objFSO = Nothing
解决方法
你可以试试这样的东西 –
Dim lineData Set fso = Server.CreateObject("Scripting.FileSystemObject") set fs = fso.OpenTextFile(Server.MapPath("imagedata.txt"),1,true) Do Until fs.AtEndOfStream lineData = fs.ReadLine 'do some parsing on lineData to get image data 'output parsed data to screen Response.Write lineData Loop fs.close: set fs = nothing