清华大佬耗费三个月吐血整理的几百G的资源,免费分享!....>>>
处理代码:
HMTL代码:
<?php header('Content-Type:text/html;charset=UTF-8'); //准备接收 /* echo '文件名:'.$_FILES['userfile']['name']; echo '文件大小:'.$_FILES['userfile']['size']; echo '错误:'.$_FILES['userfile']['error']; */ //print_r($_FILES) $tmpFile=$_FILES['userfile']['tmp_name']; if(is_uploaded_file($tmpFile)) { echo '正在上传。。。'; if(!file_exists('uploads'))//如果文件夹不存在 { mkdir('uploads'); } $moveFile =move_uploaded_file($tmpFile, 'uploads/'.$_FILES['userfile']['name']); if($moveFile) { echo "移动成功!"; //echo '<img src='.'uploads/'.$_FILES["userfile"]["name"].'> </img>'; }else { echo '移动失败!'; } }else { echo "临时文件夹找不到文件"; } ?>
HMTL代码:
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>Insert title here</title> </head> <body> <form enctype="multipart/form-data" action="fileUpload.php" method="post"> <input type="hidden" name="MAX_FILE_SIZE" value="1000000" /> 上传文件: <input type="file" name="userfile" /> <input type="submit" value="上传" /> </form> </body> </html>