download window and file name

  • Thread starter Thread starter Rados³aw Czwojdrak
  • Start date Start date
R

Rados³aw Czwojdrak

I have ASP page with force file download.
The file name is FILE.PDF but the asp page name is DOWNLOAD.ASP.
Url is .../DOWNLOAD.ASP?f=FILE.PDF
When download windows appear the file name is DOWNLOAD.ASP
- not FILE.PDF even if I set proper headers.
On my IE it is DOWNLOAD.ASP on IE my frend it is correct: FILE.PDF.
What do I set in my IE to see FILE.PDF in download window?

Regards,
Radek
 
Hi Rados,


Here is a vb snippet from my downloading asp page.
sURL = server path to the file to be downloaded.

sFileName = GetFileName(sURL) ' Should be File.pdf in your case
Response.clear
Response.AddHeader "Content-Disposition", "Attachment: filename=" &
sFilename
Response.ContentType = "application/zip"
Response.BinaryWrite GetBinaryFile(Server.MapPath("../" & sURL))
response.flush

' I test here to see if the user has completed the download and then log the
download to a database for statistics and download tracking.

If Response.IsClientConnected = true then
' Log download to database
end if

Usually for pdf files you just point to the file with a link. If a user has
a pdf reader installed IE will make the file association and download the
pdf file to the client to be viewed in the PDF reader. The user then has the
option to save the pdf file to their local drive. Most sites also give a
link to Abode for users to download the free reader.

This was not perhaps the best newsgroup to make your post. You can find
plenty of code examples on the web or at msdn.
 
Back
Top