当前位置:Gxlcms > PHP教程 > iframe实现伪AJAX无刷新文件上传

iframe实现伪AJAX无刷新文件上传

时间:2021-07-01 10:21:17 帮助过:14人阅读

<无详细内容>
  1. iframe无刷新上传文件/伪ajax上传
  2. 列表
  1. $file = $_FILES['fileToUpload'];
  2. $fileType = array('image/gif','image/jpeg','image/pjpeg');
  3. $fileSize = 20000;
  4. // $extension = pathinfo($file['name'],PATHINFO_EXTENSION);
  5. // $name = date('YmdHis',time()).rand(1000,9999).'.'.$extension;
  6. if(!in_array($file['type'],$fileType)){
  7. echo "";exit;
  8. }
  9. if($file['size']>$fileSize){
  10. echo "";exit;
  11. }
  12. if ($file["error"] > 0){
  13. echo "";exit;
  14. }
  15. if (file_exists("upload/1" . $file["name"])){
  16. echo "";
  17. }else{
  18. if(move_uploaded_file($file["tmp_name"],"upload/" . $file["name"])){
  19. echo "";
  20. }else{
  21. echo "";
  22. }
  23. }

人气教程排行