Questions tagged [content-disposition]

The Content-Disposition response header field is used in HTTP web responses to convey additional information about how to process a response payload. It can also be used to attach additional metadata such as a filename to the response.

The Content-Disposition response header field is used in HTTP web responses to convey additional information about how to process a response payload. It can also be used to attach additional metadata such as a filename to the response. The full definition of the content-disposition header is outlined in RFC 6266.

The content-disposition header is added to a HTTP response when further descriptive information is desired to aid the receiver in interpreting the payload. Usage follows the following grammar:

content-disposition = "Content-Disposition" ":" disposition-type *( ";" disposition-parm )

disposition-type = "inline" | "attachment" | disp-ext-type ; case-insensitive disp-ext-type = token

disposition-parm = filename-parm | disp-ext-parm

filename-parm = "filename" "=" value | "filename*" "=" ext-value

disp-ext-parm = token "=" value | ext-token "=" ext-value ext-token =

Questions related to this tag should be concerned with describing the payload of a HTTP Response. An example question may be - "Save a PDF that's been streamed to the browser"

448 questions
5
votes
0 answers

Opening PDF from a POST in a new tab

What I need to do : I need to open the file in a new tab in Firefox(other browser support isn't important) That filename needs to match the Content-Disposition. So I send data in my POST to a server, then I receive a PDF file in response. The…
5
votes
1 answer

IE11 not respecting filename of content-disposition

My code is opening a PDF in a tab/new window using an .apsx page and the following code: string fileName = GetFileName(so); Response.Clear(); Response.Buffer = true; Response.ContentType =…
mr2112
  • 51
  • 4
5
votes
4 answers

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…
Calua
  • 495
  • 4
  • 11
  • 18
5
votes
1 answer

How to set a filename for "Content-Disposition: inline;" file on android device?

Greeting. There's a following set of header I use to process file being opened inline in browser window(usually it is PDF): header("Content-Type: " . $mime[$ext]); header("Content-Disposition: inline; filename=" .…
4
votes
2 answers

How to serve S3 files from a Rails app?

I am trying to allow users to download a S3 file by left clicking a link. Normally, they would have to do it by right-clicking and save-as. I looked into http://apidock.com/rails/ActionController/DataStreaming/send_file but not sure if this is what…
Christian Fazzini
  • 19,613
  • 21
  • 110
  • 215
4
votes
1 answer

How to construct HttpClient POST Request with form-data in C#?

I am having issues constructing the POST request with form-data in C# using HTTPClient. i tried multiple approaches but nothing seems to work. Can you please help what I am missing? Please be informed, the SWAGGER POST is working fine and based on…
4
votes
4 answers

"Content-disposition"-like behavior with Javascript

I was wondering if it is possible to make browser behaving the same way as it does when sees "Content-disposition: attachment; filename=..." by using client-side javascript only? This implies the data for the file to be saved is available on the…
Vera
  • 51
  • 1
  • 6
4
votes
2 answers