If you do not add the first sentence, Internet Explorer cannot download **. php (from the ** website ). Internet Explorer cannot open this internet website. The requested website is unavailable or cannot be found. Please try again later.
In addition, the name is not the Set Name: report.xls, but **. php. it is OK to add the first sentence.
When reading rar, gif, and so on, the first sentence is not added. The error box is not displayed!
For images such as gif, Content-Disposition: attachment; will force a save dialog box to pop up. If it is omitted or inline, it will be displayed directly on the webpage.
The above is what I did with a stupid method (I had to try it one by one if I couldn't find the available documents ).
The values of Content-type are as follows,
Switch ($ file_extension ){
Case "pdf": $ ctype = "application/pdf"; break;
Case "exe": $ ctype = "application/octet-stream"; break;
Case "zip": $ ctype = "application/zip"; break;
Case "doc": $ ctype = "application/msword"; break;
Case "xls": $ ctype = "application/vnd. ms-excel"; break;
Case "ppt": $ ctype = "application/vnd. ms-powerpoint"; break;
Case "gif": $ ctype = "image/gif"; break;
Case "png": $ ctype = "image/png"; break;
Case "jpeg ":
Case "jpg": $ ctype = "image/jpg"; break;
Case "mp3": $ ctype = "audio/mpeg"; break;
Case "wav": $ ctype = "audio/x-wav"; break;
Case "mpeg ":
Case "mpg ":
Case "mpe": $ ctype = "video/mpeg"; break;
Case "mov": $ ctype = "video/quicktime"; break;
Case "avi": $ ctype = "video/x-msvideo"; break;
// The following are for extensions that shouldn't be downloaded (sensitive stuff, like php files)
Case "php ":
Case "htm ":
Case "html ":
Case "txt": die ("
Cannot be used for ". $ file_extension." files!"); Break;
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.