Php image file upload for detailed analysis. Upload_err_oknoerroccurred. Upload success tutorial. inifile. The maximum upload size is exceeded. upload_e upload_err_ OK no error occurred.
Uploaded
Upload_err_ini_size the uploaded file exceeds the maximum value specified in the php Tutorial. ini file.
Maximum upload size exceeded
Upload_err_form_size the uploaded file exceeds the maximum value specified by the max_file_size hidden widget.
The maximum size of the form file is exceeded.
Upload_err_partial the file upload was canceled and only part of the file was uploaded.
Upload_err_nofile no file was uploaded.
File Not uploaded
A simple file upload form
Instance 1
]
A file upload script
If (isset ($ _ files ['fupload']) {
Print "name:". $ _ files ['fupload'] ['name']."
";
Print "size:". $ _ files ['fupload'] ['size']. "bytes
";
Print "temp name:". $ _ files ['fupload'] ['tmp _ name']."
";
Print "type:". $ _ files ['fupload'] ['type']."
";
Print "error:". $ _ files ['fupload'] ['error']."
";
If ($ _ files ['fupload'] ['type'] = "image/gif "){
$ Source = $ _ files ['fupload'] ['tmp _ name'];
$ Target = "upload/". $ _ files ['fupload'] ['name'];
Move_uploaded_file ($ source, $ target); // or die ("couldn't copy ");
$ Size = getimagesize ($ target );
$ Imgstr ="
$ Imgstr. = "src =" $ target "alt =" uploaded image "/>
";
Print $ imgstr;
}
}
?>
File upload instance 2
$ Maxsize = 28480;
If (! $ Http_post_vars ['submit ']) {
$ Error = "";
}
If (! Is_uploaded_file ($ http_post_files ['upload _ file'] ['tmp _ name']) and! Isset ($ error )){
$ Error ="You must upload a file!
";
Unlink ($ http_post_files ['upload _ file'] ['tmp _ name']);
}
If ($ http_post_files ['upload _ file'] ['size']> $ maxsize and! Isset ($ error )){
$ Error ="Error, file must be less than $ maxsize bytes.
";
Unlink ($ http_post_files ['upload _ file'] ['tmp _ name']);
}
If (! Isset ($ error )){
Move_uploaded_file ($ http_post_files ['upload _ file'] ['tmp _ name'],
"Uploads/". $ http_post_files ['upload _ file'] ['name']);
Print "thank you for your upload .";
Exit;
}
Else
{
Echo ("$ error ");
}
?>
Http://www.bkjia.com/PHPjc/444783.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/444783.htmlTechArticleupload_err_ OK no error occurred. Upload successful upload_err_ini_size the uploaded file exceeds the maximum value specified in the php Tutorial. ini file. the maximum upload size is exceeded upload_e...