Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

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

Posted on 2004-10-06
2
1,140 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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
JSON error 4 71
asp syntax 3 57
ASP server side get value 15 35
alert(innerHTML); 8 32
I would like to start this tip/trick by saying Thank You, to all who said that this could not be done, as it forced me to make sure that it could be accomplished. :) To start, I want to make sure everyone understands the importance of utilizing p…
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…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

860 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