========== main.asp ================ < a href =''myPDF.asp''>读取,不保存myPDF.pdf< / a> ===================== =============== =========== myPDF.asp ============= = <% pdf(" myPDF.pdf") 函数pdf(x) Response.Clear strFileName =" / mySecretFolder /" &安培; x strFilePath = server.mappath(strFilename) ''''或:strFileName =" c:\ myRootFolder \" &安培; x 设置objStream = Server.CreateObject(" ADODB.Stream") objStream.Open objStream.Type = 1 objStream.LoadFromFile strFilePath Response.ContentType =" application / pdf" Response.BinaryWrite objStream.Read objStream.Close 设置objStream = Nothing Response.end 结束功能 %> ================================== ===== 为了更清楚,我有一个asp文件(托管在我的web服务器的c:\中)列出(filesystemobjects)的内容在D:\中的文件夹中,在这个 asp文件中我在每个文件前面有3个链接(下载/打印/打开),下载链接工作得很好但不是其他2个链接。 当我使用绝对路径并尝试从另一台PC打开文件(而不是托管网站的网络服务器)它试图在本地查找它电脑而不是电脑网络服务器,所以它给页面可以不显示 希望我澄清我的问题。[please do not toppost on usenet] Many thanks for your reply Evertjan, but actually I''m looking for code to open files not to save them.The below example gets a file from the server HD and then sends it to theclient, not neccessarily for saving.========== main.asp ================<a href=''myPDF.asp''>read, not save myPDF.pdf</a>=============================================== myPDF.asp ==============<%pdf("myPDF.pdf")function pdf(x)Response.ClearstrFileName="/mySecretFolder/" & xstrFilePath=server.mappath(strFilename)'''' or: strFileName="c:\myRootFolder\" & xSet objStream = Server.CreateObject("ADODB.Stream")objStream.OpenobjStream.Type = 1objStream.LoadFromFile strFilePathResponse.ContentType = "application/pdf"Response.BinaryWrite objStream.ReadobjStream.CloseSet objStream = NothingResponse.endend function%>======================================= To be more clear, I have an asp file (hosted in c:\ of my web server) that lists (filesystemobjects) the content of a folder in D:\, in this asp file I have in front of each file 3 links (download/print/open), the download link works great but not the 2 other links. when I use the absolute path and try to open the files from another pc (not the webserver where the website is hosted) it tries to look for it in the local computer and not the webserver so it gives "page can not be displayed" Hope I clarified my problem. 不完整,但以上帮助吗? - Evertjan。 荷兰。 (请将x''es更改为我的电子邮件地址中的点数。Not compleatly, but will the above help?--Evertjan.The Netherlands.(Please change the x''es to dots in my emailaddress) 这篇关于从硬盘打开bianry文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云! 08-28 13:52