content-disposition

Downloading pictures/Word documents using ASP.NET

If I put the following code: Response.ContentType = "image/jpeg" Response.AppendHeader("Content-Disposition", "attachment; filename=capitol.jpg") Response.WriteFile(MapPath("capitol.jpg")) into Page_Load, I will get the dialog box to download the image. But when I put the same code into a sub routine: Private Sub downloa...

Close a popup browser window only if the user saves the downloaded file

We have a popup window where the user makes some selections and clicks on a button to generate a pdf file. We show a progress display (animated gif), and then eventually send the pdf contents to the user with content-disposition: inline. The user then usually prints the pdf file. For some users, there is no inline browser viewer for pdf...

Content Dispostion header set in PHP not working with Firefox

I have a form button that submits the data to generic script (the same page that the form is loaded from, index.php) and if the right POST variables are submitted to that script, it returns a PDF for the user to print (with the relevant form info loaded, and other DB info, etc). The problem is that no matter what I set the content-type ...

Content Disposition Problem

Hi, I have a sql database that stores media files (.avi f.e.). I extract the video in a aspx page (VIDEOPAGE) as a byte array and send it to another web page calling this one (It has to be this way), and showing the video using an html object tag presenting a windows media player control. The syntax I use is: Response.ContentType = c...

Resetting wait cursor in browser with Content-Disposition:attachment

The following code works nicely: <script type="text/javascript"> var prm = Sys.WebForms.PageRequestManager.getInstance(); prm.add_initializeRequest(InitializeRequest); prm.add_endRequest(EndRequest); function InitializeRequest(sender, args) { document.body.style.cursor = 'progress'; } function EndRequest...

View contents of file with Content-disposition: attachment using socket

Hi, I want to parse the contents of a dynamic .csv file. However, this code (obviously with duff file names, etc.): $socket = fsockopen("www.example.com", 443); fwrite($socket, "GET /dynamicCsv.csv?param=value HTTP/1.1\r\n"); fwrite($socket, "Host: www.example.com\r\n"); fwrite($socket, "Connection: close\r\n"); fwrite($socket, "\r\n")...

IE and Content-disposition inline vs. extension-token [unanswered]

This question, despite accepted-answer, was not answered. The reason it has an answer marked as accepted is because the bounty system, which I used, demands one. You are still welcome to answer this question if you know the answer (please do) - I will try to reputation-pay you in upvotes elsewhere. (Reputation purists may now throw rocks...

How to rewrite and set headers at the same time in Apache

I have a directory of images that alternately be viewed directly in the browser, and other times downloaded. So, say I have a file /gallery/gal_4254.jpg. I want to make /download/gal_4254.jpg trigger a download of the image rather than view it. /download is empty, all the images are in /gallery. I can map requests to the download d...

Java webapp: adding a content-disposition header to force browsers "save as" behavior

Even though it's not part of HTTP 1.1/RFC2616 webapps that wish to force a resource to be downloaded (rather than displayed) in a browser can use the Content-Disposition header like this: Content-Disposition: attachment; filename=FILENAME Even tough it's only defined in RFC2183 and not part of HTTP 1.1 it works in most web browsers as...

Content-disposition:inline header won't show images inline?

I'm trying to show an image inline on a page. It is being served by a codeigniter controller. class Asset extends MY_Controller { function index( $folder, $file ) { $asset = "assets/$folder/$file"; if ( !file_exists( $asset ) ) { show_404(); return; } switch ( $folder ) ...

How to handle error with content-disposition

Hi, how should I handle an exception that occurs after sending a Content-Disposition header for an attachment? I'm trying to generate a report at server and send it as a file, but if an exception occurs during the report generation, the error message itself is sent to browser which still takes it as a content of a file and shows a Save ...

Amazon AWS S3 to Force Download Mp3 File instead of Stream It

I'm using Amazon S3 to put the mp3 file then allow our site visitor to download the mp3 from Amazon AWS. I use S3Fox to manage the file, everything seems working fine until recently we got many complaints from visitor that the mp3 was streamed via the browser instead of displaying browser save dialog. I try for some mp3 and notice that f...

Parsing content-disposion header's filename in multipart/from-data

Hello According to RFC, in multipart/form-data content-disposition header filename field receives as parameter HTTP quoted string - string between quites where character '\' can escape any other ascii character. Problem web browsers don't do it. IE6 sends: Content-Disposition: form-data; name="file"; filename="z:\tmp\test.txt" Inste...

images served with content-disposition: inline are being shown as attachments

I've observed this behaviour on gmail and yahoo, but my concern is gmail anyway. This is the header of the image mime part that I'm sending. Content-Type: image/jpeg; name=image0.jpeg Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename=image0.jpeg Content-ID: <image0> Gmail seems to modify the headers for some reaso...

Force download of files on App Engine

How would I go about forcing the browser to download media files instead of attempting to stream them? These are static files in my application directory. ...

docx file doesnt open in browser with content disposition inline in IE 8

I want to open docx file in IE from asp.net. The IIS has mime type correctly mapped. I can open pdf fine but docx will always prompt me to download like content-disposition='attachment'. Is there any setting to be done? Response.Clear(); Response.ClearContent(); Response.ClearHeaders(); ...

How to change filename prompt text browser Save As dialog?

Hello, In my web page (rendered by Rails), I'd like to let the user right-click on a photo to bring up the browser's Save As dialog, to let the user save the photo to their hard drive. However, the photos on my server have unusual filenames (long hex names) with no file extension. The filename prompt in the Save As dialog has this ugly...

Trouble creating csv for download

Using this lovely example I am getting some funky results. What I have is: Protected Sub btnCSV_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnCSV.Click Response.Clear() Response.Buffer = True Response.ContentType = "text/csv" Response.AppendHeader("Content-Disposition", "inline; filename=" + Fil...

Is there a way to tell browsers to disable the "run" button when downloading an EXE?

It may be convenient for some of the unlimited bandwidth types to let your users continually download your product and continually forget where they put it and redownload it. But perception of scarcity of is the beginning of wisdom as the bail bondsman said to the coroner as he brought in the week's catch in a two meter gunny sack and I...

File for download in ASP.NET

Hi, I have a "dummy" page to force the "SaveAs" pop-up when they click a link to download a document. the request for that site is ajax, and the site is called. I can se that it got all the right params, but when it comes to this part nothing happens. var filepath = Request["filepath"]; //Set the appropriate ContentType. Response.Con...