PHP上传文件

1.html

<html>
<head>
<title>Upload Files</title>
</head>
<body>

<form enctype="multipart/form-data" action="upload_file.php" method="post">
<center>
<input type="hidden" name="MAX_UPLOAD_FILE" value="10000">
<input type="file" name="upload_file">
<input type="submit" value="Submit">
</center>
</form>

</body>
</html>

  

2.php

<?php

$dir_name=__DIR__;
echo $_FILES;
$file_name = $dir_name.$_FILES['upload_file']['name'];

if(move_uploaded_file($_FILES['upload_file']['tmp_name'],
	$file_name)){
		echo "OK";
	}
	else{
		echo "ERORR";
	}

?>

  

posted on 2015-08-21 21:10  hujun1992  阅读(337)  评论(0编辑  收藏  举报

导航