一聚教程网:一个值得你收藏的教程网站

最新下载

热门教程

php最简单文件上传代码

时间:2011-06-06 编辑:简简单单 来源:一聚教程网

我们实现最简单的文件上传功能,只要利用php教程自带的move_uploaded_file函数就可以方便实现

 

     $tmp_filename = $_FILES['myupload']['tmp_name'];
     if(!move_uploaded_file($tmp_filename,"/path/to/dest/{$_FILES['myupload']['name']}")) {
          echo "An error has occurred moving the uploaded file.
";
          echo "Please ensure that if safe_mode is on that the " . "UID PHP is using matches the file.";
          exit;
     } else {
          echo "The file has been successfully uploaded!";
     }
?>

热门栏目