Open In App

HTTP headers | Content-Disposition

The HTTP Content Disposition is a response-type header field that gives information on how to process the response payload and additional information such as filename when user saves it locally. This response header field holds a number of values and parameters in the larger context of MIME (Multipurpose Internet Mail Extensions). However, it reduces to a fixed set of parameters and values under HTTP forms and POST requests. 

The Content Disposition header field takes different values while working as a response header for data enclosed in the main body, forms, or multiple parts of the content. It has an option to make the data available locally or display it in the browser while treating content present in the main body present on the browser. It can give information about the specified field of data which are stored as sub-parts in Multipart/Form data. 



Syntax : 

Content Disposition : inline 
Content Disposition : attachment
Content Disposition : attachment ; filename = "file_name.html"
Content-Disposition : form-data
Content-Disposition : form-data; name="field_value"
Content-Disposition : form-data; name="field_value"; filename="file_name.html"

Directives : 



1. Content Disposition Type : 

2. Content Disposition Parameters : 

3.Working of Content Disposition and Multipart : 

Examples :  The following examples have been taken from RFC 6266 and RFC 7578. 

content-disposition: form-data; name="field1"

 content-disposition: form-data; name="_charset_"

Content-Disposition: attachment;
filename="EURO rates";
filename*=utf-8''%e2%82%ac%20rates

 Content-Disposition: inline ; filename=example.html

Supported Browsers :  The browsers  supported by HTTP headers | Content-Disposition are listed  below

Article Tags :