asp-classic – 如何在经典的asp中读取文本文件
发布时间:2020-05-23 23:00:12 所属栏目:asp.Net 来源:互联网
导读:我正在上传图片.上传图片时,我将图片名称和该文件的链接保存在一个文本文件中. 喜欢这个, abc.jpeg,HTTP://google.com 现在我想使用经典的asp显示所有带有相应链接的图像. 我该怎么做? 请帮忙. 我用过这个asp代码: %For Each FileName in fold.FilesDim Fn
|
我正在上传图片.上传图片时,我将图片名称和该文件的链接保存在一个文本文件中.
现在我想使用经典的asp显示所有带有相应链接的图像. 我该怎么做? 请帮忙. 我用过这个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 (编辑:安卓应用网) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
相关内容
- asp.net-core – Controller.json设置Serialization.Refere
- asp.net – project.json中的“依赖关系”和“框架集”之间
- asp.net – $.post vs $.ajax
- asp.net-core – MVC 6 Web Api:解析201上的位置标题(已创
- ASP.NET动态创建控件和回发
- asp.net – 下载列表asp mvc
- asp.net-mvc – MVC 5 HttpErrors控制器/动作
- asp.net-mvc – 值不能为空或为空.参数名称:contentPath
- asp.net – MVC5认证中的“和主域之间的信任关系失败”
- ASP.NET MVC在javascript中使用ViewData
推荐文章
站长推荐
- asp.net-mvc – 重用MVC arhitecture;有两层UI:
- asp.net-core – 编译netcoreapp1.0,代码包含#if
- asp.net – 检查ValidationGroup是否从代码隐藏有
- asp.net-mvc – 使用MVC3剃刀的ASP.Net图表控件
- Asp.net Webform显示警报和重定向
- asp.net – 访问asp:从代码背后的内容
- 如何在ASP.NET MVC中具有相同名称的文件夹和控制
- asp.net – AutoMapper:将集合中的项目值从一个
- .net – 我应该如何设计一个允许IoC的类库,但不依
- 页面生成时间 – ASP.Net MVC
热点阅读
