Solved

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

Posted on 2004-10-06
2
1,142 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
[X]
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
  • 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: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say 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
Html Table looping 4 43
JQuery Autocomplete Tag AJAX (Need nice script) 11 76
Send form to asp server side 6 38
Validating Date Part2 2 47
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…
This demonstration started out as a follow up to some recently posted questions on the subject of logging in: http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28634665.html and http://www.experts-exchange.com/Programming/…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…
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…

752 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