What folder is p2pcache? Simple analysis of PHP file upload principle

WBOY
Release: 2016-07-29 08:45:17
Original
2101 people have browsed it

//Form uploads can only use the multipart/form-data encoding format
$_FILES system function;
$_FILES['myFile']['name'] file name
$_FILES['myFile']['type'] file Type, restricted by the server
image/**
image/x-png
application/x-zip-compressed
$_FILES['myFile']['size'] Upload file size
$_FILES['myFile'][ 'tmp_name'] Save temporary file name after uploading to service
$_FILES['myFile']['error'] Error code;
0 Success 1 Exceeded php.ini size 2 Exceeded the value specified by MAX_FILE_SIZE option
3 Only partial upload 5 Upload The file size is 0
move_uploaded_file (temporary file, target location and file name);
Function to move the file to the target location after uploading
is_uploaded_file(MIME);
Function to determine the uploaded MIME type of the file

Copy code Code As follows:




if(is_uploaded_file($_FILES['myFile']['tmp_name'])){
$upfile = $_FILES['upload'];
$name = $upfile['name'];
$type = $ upfile['type'];
$size = $upfile['size'];
$tmp_name = $upfile['tmp_name'];
$error = $upfile['error'];
switch($type){
case 'image/pjpeg' : $ok=1;
break
}
if($ok){
move_uploaded_file($tmp_name,'up/'.$name);
}else{
echo "File type not allowed ";
}
}

The above has introduced what kind of folder p2pcache is. A simple analysis of the principle of PHP file upload, including what kind of folder p2pcache is. I hope it will be helpful to friends who are interested in PHP tutorials.

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