php上传思路很主要 举一反三

WBOY
Release: 2016-06-13 12:37:16
Original
1017 people have browsed it

php上传思路很重要 举一反三

1、FORM标签enctype属性
表单中enctype="multipart/form-data"的意思,是设置表单的MIME编码。默认情况,
这个编码格式是application/x-www-form-urlencoded,不能用于文件上传;
只有使用了multipart/form-data,才能完整的传递文件数据
input标签 type 属性中的  "file"

2、$_FILES 系统函数
$_FILES['myFile']['name']   客户端文件的原名称。
$_FILES['myFile']['type']   文件的 MIME 类型,例如"image/gif"。
$_FILES['myFile']['size']   已上传文件的大小,单位为字节。
$_FILES['myFile']['tmp_name']   储存的临时文件名,一般是系统默认。
$_FILES['myFile']['error']   该文件上传相关的错误代码。

3、move_uploaded_file函数
上传后移动文件到目标位置的函数
move_uploaded_file(临时文件,目标位置和文件名);

4、is_uploaded_file 函数
判断上传MIME类型的文件函数
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
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!