Home > php教程 > PHP源码 > body text

PHP最基本上传代码示例

PHP中文网
Release: 2016-05-25 16:58:10
Original
1225 people have browsed it

php代码

<html>
<head><meta charset="utf-8"></head>
<body>
	<form method="post" enctype="multipart/form-data"> 
	上传:<input type="file" name="myfile" /><input type="submit" value="上传" /> 
	</form>
</body>
</html>
<?php
if ( isset($_FILES[&#39;myfile&#39;]) ) {
	echo $_FILES[&#39;myfile&#39;][&#39;name&#39;];
	$up = move_uploaded_file($_FILES[&#39;myfile&#39;][&#39;tmp_name&#39;], &#39;uped.jpg&#39;);
	echo $up ? &#39;上传成功&#39; : &#39;上传失败&#39;;
}
?>
Copy after login
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template