通过隐藏的iframe来实现异步上传 html代码:
========================================================================================================= php代码: $uploaddir = "upload/img/"; $ext = substr(strrchr($_FILES['userfile']['name'], '.'), 1); $uploadfile = $uploaddir.time().rand(0,999).".".$ext; if($_FILES['userfile']['type'] == 'image/jpeg' || $_FILES['userfile']['type'] == 'image/gif') { } else { echo ""; exit; } switch ($_FILES["userfile"]["error"]) { case 0: if (file_exists($uploadfile)) { echo ""; break; } else { if(move_uploaded_file($_FILES["userfile"]["tmp_name"],$uploadfile)) { echo "success"; } else { echo ""; break; } } case 1: echo ""; break; case 2: echo ""; break; case 3: echo ""; break; case 6: echo ""; break; case 7: echo ""; break; }php异步读写文件,异步上传文件以及php对文件的处理
最新推荐文章于 2021-04-02 16:15:44 发布