Home > Backend Development > PHP Tutorial > php文件上传有关问题--各位大侠帮忙看一下

php文件上传有关问题--各位大侠帮忙看一下

WBOY
Release: 2016-06-13 12:02:16
Original
881 people have browsed it

php文件上传问题--各位大侠帮忙看一下








PHP代码
if($_FILES['my_file']['error'] > 0){  
echo "wrong " . $_FILES['my_file']['error'];  
}else{
if($_FILES["my_file"]["tmp_name"]){
  echo "name = ".$_FILES["my_file"]["tmp_name"];
echo "name2 = "."img/".$_FILES["my_file"]["name"];
  if(move_uploaded_file($_FILES["my_file"]["tmp_name"], "/img/".$_FILES["my_file"]["name"])){
  echo "成功";
  }else{
  echo "失败";
  }
  }

上传文件时,一直提示失败。
上传结果:
name = C:\\Windows\\Temp\\php595E.tmp name2 = img/634914612464629528.jpg失败
------解决方案--------------------
 if(move_uploaded_file($_FILES["my_file"]["tmp_name"], "/img/".$_FILES["my_file"]["name"])){
怎么成了绝对路径了?
------解决方案--------------------
估计是路径问题,打开错误提示功能看看。
------解决方案--------------------
整个文件夹是可写的吗
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 Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template