Background server to the front page video, how can download, not directly play

Source: Internet
Author: User

Content-type

This header contains the "Mime-type" of the document. The navigator will determine how the document is parsed based on this parameter. For example, an HTML page (or a PHP page with HTML output) would return something like this:

content-type:text/html; Charset=utf-8

' Text ' is the document type, ' HTML ' is the type of text. This header also includes more information, such as CharSet.

If it is a picture, this response will be sent:

Content-type:image/gif

The Mime-type can be used by the navigator to decide whether to open the document using an external program or its own extension. The following example drops the call to Adobe Reader:

Content-type:application/pdf

Directly loaded, Apache will usually automatically determine the mime-type of the document and add the appropriate information to the header. And most of the browser has a degree of fault tolerance, it will automatically detect Mime-type in case the header is not provided or the information is provided incorrectly.

You can find a list of commonly used mime-type here.

In PHP you can detect the Ime-type of a file by Finfo_file ().

Content-disposition

This header tells the browser to open a file download window instead of trying to parse the content of the response. For example:

Content-disposition:attachment; Filename= "Download.zip"

He causes the dialog box to appear in the browser:

Download dialog box

Note that the Content-type header information that is appropriate for it will also be sent

Content-type:application/zip
Content-disposition:attachment; Filename= "Download.zip"

You can change the HTML headers:

Content-type:application/zip

Content-disposition:attachment; Filename= "Download.mp4"

This will not play, directly downloaded

Refer to the following:

Content-type

This header contains the "Mime-type" of the document. The navigator will determine how the document is parsed based on this parameter. For example, an HTML page (or a PHP page with HTML output) would return something like this:

content-type:text/html; Charset=utf-8

' Text ' is the document type, ' HTML ' is the type of text. This header also includes more information, such as CharSet.

If it is a picture, this response will be sent:

Content-type:image/gif

The Mime-type can be used by the navigator to decide whether to open the document using an external program or its own extension. The following example drops the call to Adobe Reader:

Content-type:application/pdf

Directly loaded, Apache will usually automatically determine the mime-type of the document and add the appropriate information to the header. And most of the browser has a degree of fault tolerance, it will automatically detect Mime-type in case the header is not provided or the information is provided incorrectly.

You can find a list of commonly used mime-type here.

In PHP you can detect the Ime-type of a file by Finfo_file ().

Content-disposition

This header tells the browser to open a file download window instead of trying to parse the content of the response. For example:

Content-disposition:attachment; Filename= "Download.zip"

Reference Source: https://www.cnblogs.com/A-Song/archive/2012/01/26/2329715.html

Background server to the front page video, how can download, not directly play

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.