Home > Backend Development > PHP Tutorial > 文件上传类型限制解决办法

文件上传类型限制解决办法

WBOY
Release: 2016-06-13 13:34:40
Original
1510 people have browsed it

文件上传类型限制
if ((($_FILES["file"]["type"] == "image/gif")
|| ($_FILES["file"]["type"] == "image/jpeg")
|| ($_FILES["file"]["type"] == "image/pjpeg"))

这个是图片限制
那限制RAR ZIP
text doc的文件类型怎么写?

------解决方案--------------------
那你得先收集你要限制的文件的mime类型。
ZIP的MIME类型用application/x-zip-compressed 
RAR的MIME类型用application/octet-stream
text的MIME类型有 text/plain
搜到个列表 http://www.wilf.cn/post/MIME_type.html
------解决方案--------------------
http://www.wilf.cn/post/MIME_type.html

这个好,顶一个

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template