iframe实现伪AJAX无刷新文件上传
时间:2021-07-01 10:21:17
帮助过:14人阅读
<无详细内容>
-
- iframe无刷新上传文件/伪ajax上传
-
-
-
-
-
-
-
-
-
- $file = $_FILES['fileToUpload'];
- $fileType = array('image/gif','image/jpeg','image/pjpeg');
- $fileSize = 20000;
- // $extension = pathinfo($file['name'],PATHINFO_EXTENSION);
- // $name = date('YmdHis',time()).rand(1000,9999).'.'.$extension;
- if(!in_array($file['type'],$fileType)){
- echo "";exit;
- }
- if($file['size']>$fileSize){
- echo "";exit;
- }
- if ($file["error"] > 0){
- echo "";exit;
- }
- if (file_exists("upload/1" . $file["name"])){
- echo "";
- }else{
- if(move_uploaded_file($file["tmp_name"],"upload/" . $file["name"])){
- echo "";
- }else{
- echo "";
- }
- }
|