I'm creating an ASP classic application that let's users download and save PDF files without having to bring them up in the browser. I have successfully used the LoadFromFile method to perform this feat but not in the manner in which I ultimately want things to be.
Currently the PDF's sit on the server itself, but I would like for these to be on a different computer. When I try to set up this scenario, the LoadFromFile method can never find the file.
My first thought was to Map a network drive to the location of the PDF's on the other computer. Still, LoadFromFile can't find the files.
Is there any way to use LoadFromFile on the server, but have the file I'm looking for reside on a diffrent computer on the same network?
Here is my logic....
Where I set the CompletePath variable, "S:" is the mapped network drive.
Expand|Select|Wrap|Line Numbers
- If Len(Trim(Session("MEMBER_ID"))) > 0 Then
- Response.Clear
- Response.contentType = "application/octet-stream"
- Response.addheader "content-disposition", "attachment; filename=" & FileName
- Set Stream = server.CreateObject("ADODB.Stream")
- Stream.Type = adTypeBinary
- Stream.Open
- CompletePath = "S:\Inetpub\wwwroot\PDF\" & GroupName & "\" & FileName
- Stream.LoadFromFile CompletePath
- While Not Stream.EOS
- Response.BinaryWrite Stream.Read(1024 * 64)
- Wend
- Stream.Close
- Set Stream = Nothing
- 'Response.write("<html>")
- 'Response.write(CompletePath)
- 'Response.write("</html>")
- Response.Flush
- Response.End
- End If