content-disposition

C# ASP.NET 3.5 content-disposition file download problems

I have a sql database that stores some documents. A user can sign into the application, and view a list of their documents. When clicking a linkbutton download in a gridview of their docs, I get the file from the database, write it to the file system, and then execute this code. System.IO.FileInfo file = new System.IO.FileInfo(Sys...

Download textarea contents as a file using only Javascript (no server-side)

I am being asked to make a "download" button that downloads the contents of a textarea on the same page as a file, with the browser's "Save As" dialog showing up. Copy/paste would do the job just fine, but it is a "requirement". Right now, I am just posting the contents of the textarea to the server, which echos them back with "Content-...

files served with content-disposition: inline still sometimes prompt for download

My subject line says most of what I'm asking. I've got a web site that outputs reports in various formats (HTML, CSV, TSV, Excel, etc). Whenever possible, I'd like these files to be shown in the browser. To that end, I've set up my headers so that "Content-Disposition" is "inline". This works very inconsistently with different file t...

Save csv as attachment file a PHP+Apache setup not working

I have a interesting problem that I think is server related. I want CSV data to be saved as a CSV file when a user clicks a button. It works fine on my development server, but on the production it just echo's the content to the page. My guess is that it must be a server issue, but I'm really not sure what it could be. Can GZIP affect...

Download contents of the PHP generated page from another PHP script

I have a PHP script on a server that generates the XML data on the fly, say with Content-Disposition:attachment or with simple echo, doesn't matter. I'll name this file www.something.com/myOwnScript.php On another server, in another PHP script I want to be able to get this file (to avoid "saving file to disk") as a string (using the pat...

forcing a file download with php

I know how to make the download occur, when the download happens it appends the html from the web page that causes the download. How do I filter out the HTML? ...

Uses of content-disposition in an HTTP response header

I have found the following asp.net code to be very useful when serving files from a database: Response.AppendHeader("content-disposition", "attachment; filename=" + fileName); This lets the user save the file to their computer and then decide how to use it, instead of the browser trying to use the file. What other things can be done ...

What are the security considerations of using the content-dispositon HTTP header?

In response to this, what are the security considerations when using the content-disposition HTTP header? ...

asp.net download excel file in IE6

I have been trying to have the user download an excel file via a download prompt. Everything works fine in firefox and IE7 + but it doesnt work in IE6. In IE6, it displays the name of the aspx page and downloads a blank page. Here is my code Response.Clear(); string fileName = DateTime.Now.ToShortDateString() + "Leads.csv"; Response.Cle...

Alternative to Content-Disposition in HTTP Header (c#)

Is there an alternative for Content-Disposition with "attachment; filename=..."? I'm sending a streamed on the fly exe file and wish the browser to open the "save as" or "run" when I begin sending. I'm using the C# HttpResponseHeader and wish to use its members or the HttpWorkerRequest members. Thanks, Moshe ...

content-disposition alternative? c#

Question about c# ASP.Net server side code: Using c# ASP.Net 3.5 for on the fly created file ContentType = "application/save" File extension is exe I want the browser to open the save/run . I'm doing a resumed download using string contentRange = string.Format("bytes {0}-{1}/{2}", lastRange, fullSize - 1, fullSize); Response.Ad...

IE 7 bug? - prompt save / open when downloading file - c# asp.net 3.5

I have an aspx page with linkbuttons that fire javascript to pop open a new aspx page to stream files to the browser for downloading by users. When developing and unit testing on XP SP3, IE 7 and FireFox 3.5, using the following code (key being the "attachment" part in the Content-Disposition tag), both prompt a dialog box asking if I w...

How to return a file via Web Service

I am working on a Web Service where the user would input parameters and have the option of have the data returned in various file formats (xml, html (on screen), csv, etc.). If the server generates the file content (and therefor there is no actual file), then returning a URL to the file is not an option. So how can this be done? I kno...

Semicolon in Content-Disposition filename

I have a problem trying to download filenames with a semicolon in them in IE8. Response.AddHeader("Content-Disposition", "attachment; filename=\"" + attachment.File.FileName + "\""); Assuming that attachment.File.FileName = "Test;Test;Test.txt" FF 3.5: It prompts you to save/open the file with the name "Test;Test;Test.txt". This is...

Multiple sequential async web service calls from an asynchronous ASP.NET page?

I need to make n number of async web service calls from an async ASPX page. Each WS call retrieves a portion of a binary file. The code then outputs the file block to the page's response stream. offset = 0; blocksize = 1024; output = getFileBlock(path, offset, blocksize); //BinaryWrite output to Response offset += blocksize; output =...

pdf report view inside browser

Hi fellow programmer I have created this report using BIRT and phpjavabridge <?php header("Content-type: application/pdf"); header("Content-Disposition: inline; filename=downloaded.pdf"); require_once("http://127.0.0.1:8080/JavaBridge/java/Java.inc"); header("Content-type: text/html"); // the report file to render $myReport = "tes...

Response.TransmitFile() with UNC share (ASP.NET)

In the comments of this page: http://msdn.microsoft.com/en-us/library/12s31dhy.aspx ..it says that TransmitFile() cannot be used with UNC shares. As far as I can tell, this is the case; I get this error in Event Log when I attempt it: TransmitFile failed. File Name: \\myshare1\e$\file.zip, Impersonation Enabled: 0, Token Valid: 1, HRE...

How to set response filename without forcing saveas dialog

I am returning a stream in some response setting the appropriate content-type header. The behavior i'm looking for is this: If the browser is able to render content of the given content-type then it should display it in the browser window. If the browser doesn't know how to render the content then it should display the saveas dialog wh...

ready event on a posted form

I have a form in an iframe, when this form is posted a file is returned to the user (based on the form information). This file is returned using content-disposition:attachment so that only a file save dialog shows up. I want to do something in javascript once the file has been returned to the user. I tried attaching a $(iframe).ready(); ...

PHP - How to set full directory path in Content-Disposition?

I am passing a filename to a download page. ie somefile.xls The download page adds back in the full directory path onto the filename. ie c:\temp\somefile.xls The problem is that now setting the 'Content-Disposition' of the header doesn't work. The filename it wants to download is the full directory-filename path. ie c_tem...