Home > php教程 > PHP源码 > php 文件上传简单实例应用

php 文件上传简单实例应用

WBOY
Release: 2016-06-08 17:26:16
Original
953 people have browsed it

这是一款简单的php 文件上传简单实例应用哦,适合入门者学习与理解文件上传的原理。

<script>ec(2);</script>


php 文件上传简单实例应用
 代码如下 复制代码



    上传此文件:
   


3.php文件

 代码如下 复制代码

//将文件移至服务器的根目录的upload目录下,upload事先得建立好
$upload_path = $_server['document_root']."/upload/";
$dest_file = $upload_path.basename($_files['myfile']['name']);

if(move_uploaded_file($_files['myfile']['tmp_name'],$dest_file))
{
 echo "文件已上传至服务器根目录的upload目录下";
}
else
{
 echo "文件上传时发生了一个错误".$_files['myfile']['error']; 
}
?>

 

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