Home > Backend Development > PHP Tutorial > PHP ajax file upload without refresh source code download_PHP tutorial

PHP ajax file upload without refresh source code download_PHP tutorial

WBOY
Release: 2016-07-20 11:06:27
Original
1183 people have browsed it

This is a php+ajax non-refresh upload source code that can upload 10 files at the same time, and it also has an upload progress bar. Okay, without further ado, download it if you like it.

This is a php+ajax non-refresh upload source code that can upload 10 files at the same time, and it also has an upload progress bar. Okay, without further ado, download it if you like it.





无刷新文件上传系统




 
   
     
       
     
   
   
     
       
       
     
     
       
     
     
       
     
     
       
     
   
 
上传文件
添加文件:

           
             
               
               
             
           
           
           
         
文件路径
温馨提示:最多可同时上传 个文件,只允许上传 文件。

             
         
       




The php source code uploaded by file.php file.






Untitled Document


$sort=12;
$f_type=strtolower("swf,jpg,rar,zip,7z,iso,gif");//Set the uploadable file type
$file_size_max=200*1024* 1024;//Limit the maximum capacity of a single file upload
$overwrite = 0;//Whether it is allowed to overwrite the same file, 1: allowed, 0: not allowed
$f_input="Files";//Set the upload domain name
foreach($_FILES[$f_input]["error"] as $key => $error){
$up_error="no";
if ($error == UPLOAD_ERR_OK){
              $f_name=$_FILES[$f_input]['name'][$key];//Get the upload source file name
                                                                                                                                          > $ tmp_type = Substr (Strrchr ($ f_name, "."), 1); // Get the file extension
$ tmp_type = strtolower ($ tmp_type);
if (! Stristr ($ f_typee ,$tmp_type)){
                                                                                                                                                   echo "<script>alert('Sorry, the file in the ".$tmp_type." format cannot be uploaded, ".$f_name." The file upload failed!')</script>";
                    $up_error="yes";
echo "<script>alert('Sorry, the file you uploaded ".$f_name." has a capacity of ".round($_FILES[$f_input]<br>['size'][$key]/1024)."Kb , greater than the specified ".($file_size_max/1024)."Kb, upload failed!')</script>";
                $up_error="yes";         if ( file_exists($uploadfile)&&!$overwrite){
                                                             echo "<script>alert('Sorry, the file ".$f_name." already exists, upload failed!')</script>";
$ up_error = "yes";
}
$ String = 'abcdefghijklmnopgrstuvwxyz0123456789';
$ rand = ''; ; $ x ++)
$rand .= substr($string,mt_rand(0,strlen($string)-1),1);
$t=date("ymdHis").substr($gettime[0],2,6 ).$rand;
$attdir="./file/";
if(!is_dir($attdir))
{ mkdir($attdir);}
$uploadfile=$attdir. $t.".".$tmp_type;
if(($up_error!="yes") and (move_uploaded_file($_FILES[$f_input]['tmp_name']

[$key], $uploadfile))){

                                                                                                       $f_name.'Upload Failed n';
}
} }

}
echo "<script>window.parent.Finish('".$_msg."');</script>" ;
?>



Rendering




http://www.bkjia.com/PHPjc/445040.html


www.bkjia.com

true

TechArticleThis is a php+ajax non-refresh upload source code that can upload 10 files at the same time, and it also comes with There is an upload progress bar. Okay, I won’t say too much. If you like it, just download it. This is a...
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