文件没有上传PHP PHP tmp / php错误

时间:2017-07-17 06:59:42

标签: php

我有一个php脚本,可以在5个目录中上传5个附件文件,用于数据。

表单的属性为“enctype =" multipart / form-data"

<input type="file" name="file_photo" id="file_photo">

我的PHP脚本是:

$filename_p = $_FILES["file_photo"]["name"];
$file_basename_p = substr($filename_p, 0, strripos($filename_p, '.')); // get file extention
$file_ext_p = substr($filename_p, strripos($filename_p, '.')); // get file name
$newfilename_p = $cname . "_" . $file_basename_p . $file_ext_p;
move_uploaded_file($_FILES["file_photo"]["tmp_name"], "Uploads/photo/" . $newfilename_p);

Uploads/photo/目录具有权限:755

文件未在目录Uploads/photo/

中上传

print_r($_FILES);的输出是:

Array ( [file_photo] => Array ( [name] => IICB-logo (1).jpg [type] => image/jpeg [tmp_name] => /tmp/phpFkYJgw [error] => 0 [size] => 12857 ) 

php.iniupload_max_filesize = 200Mmax_file_uploads = 200

我该怎么办?

1 个答案:

答案 0 :(得分:0)

检查Uploads/photo/的所有者是否与运行php的所有者相同。如果不更改目录的所有者:chown [user] Uploads/photo/。假设您可以访问命令行。