moony marouane wrote on 24 dec 2005 in
microsoft.public.inetserver.asp.general:
[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 the
client, 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.Clear
strFileName="/mySecretFolder/" & x
strFilePath=server.mappath(strFilename)
'' or: strFileName="c:\myRootFolder\" & x
Set objStream = Server.CreateObject("ADODB.Stream")
objStream.Open
objStream.Type = 1
objStream.LoadFromFile strFilePath
Response.ContentType = "application/pdf"
Response.BinaryWrite objStream.Read
objStream.Close
Set objStream = Nothing
Response.end
end 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.
Not compleatly, but will the above help?