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

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

WBOY
Release: 2016-06-23 13:53:48
Original
883 people have browsed it








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