Solved

set default filename when saving binary-written-to-browser pdf

Posted on 2004-10-06
2
1,137 Views
Last Modified: 2008-01-09
i am displaying PDF files in a web browser using asp

i am trying to set the default filename (that appears in the file name box) when the "save a copy of the file" button is clicked, but it seems that i can't

following is my code:

Response.Buffer = True
Response.Clear
Response.ContentType = "application/pdf"
Response.AddHeader "Content-Disposition", "inline; filename=x.pdf"
Response.BinaryWrite sBinaryFile
Response.Flush
Response.End

any ideas?

thanks,

f
0
Comment
Question by:papaflo
  • 2
2 Comments
 
LVL 10

Accepted Solution

by:
dij8 earned 50 total points
ID: 12242941
You have no control over these kind of boxes that appear on the clients browser.  This is a security issue.  It is also that the save as dialog box is not actually part of the browser but part of the native operating system.  The box will always come up with the name of the file being saved, in this case "x.pdf".

A way around this is to use the FileSystemObject and copy the PDF document to a folder naming it whatever you want and then rendering the page using the copied file.  This will still open the save as dialog with the given file name except you have controlled the name on the server.
0
 
LVL 10

Expert Comment

by:dij8
ID: 12302723
Glad I could help.
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

I recently decide that I needed a way to make my pages scream on the net.   While searching around how I can accomplish this I stumbled across a great article that stated "minimize the server requests." I got to thinking, hey, I use more than one…
I was asked about the differences between classic ASP and ASP.NET, so let me put them down here, for reference: Let's make the introductions... Classic ASP was launched by Microsoft in 1998 and dynamically generate web pages upon user interact…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now