PHP implementation of File upload source code,
PHP implementation of File upload source code, more PHP technology development on the PHP tutorial network, http://php.662p.com
m.jpg [Type] = Image/jpeg [Tmp_name] = C:\WINDOWS\Temp\php1A.tmp [ERROR] = 0 [size] = 44905) $name = $upfile ["Name"];//is convenient for later transfer of a file $type = $upfile The type of the upload file $size = $upfile ["Size"];//the upload file $tmp _n Ame= $upfile ["Tmp_name"];//the temporary name of the user to upload the file $error = $upfile ["Error"];//errors in the upload process//echo $name; Judge the file type, determine whether to transfer the file, if required to set $ok=1 can transfer switch ($type) {case "image/jpg": $ok = 1; Break Case "Image/jpeg": $ok = 1; Break Case "Image/gif": $ok = 1; Break Default: $ok = 0; Break }//If the file meets the requirements and there is no error in the upload process if ($ok && $error = = ' 0 ') {//Call Move_uploaded_file () function for file transfer Move_uploaded_file ($tmp _name, ' up/'. $name); After successful operation, the prompt is successful echo ""; }else{//If the file does not conform to the type or if there is an error in the upload process, the message fails echo ""; }}?>
Detailed Description: http://php.662p.com/thread-570-1-1.html
http://www.bkjia.com/PHPjc/912476.html www.bkjia.com true http://www.bkjia.com/PHPjc/912476.html techarticle PHP Implementation of File upload source code, PHP implementation of File upload source code, more PHP technology development to PHP tutorial network, http://php.662p.com? PHP # #author: Androidyue # #sina @androidyue # # Blog ...