这是错误
警告:move_uploaded_file()[function.move-uploaded-file]:open_basedir限制生效。文件(C:\ Windows \ Temp \ php205.tmp)不在允许的路径中:(E:\ inetpub \ vhosts \ astradingcompany.org \ httpdocs)在E:\ inetpub \ vhosts \ astradingcompany.org \ httpdocs中第26行\ mycar \ postaddata.php
警告:move_uploaded_file(mycar / uploads / car001.jpg)[function.move-uploaded-file]:无法打开流:E:\ inetpub \ vhosts \ astradingcompany.org \ httpdocs \ mycar中没有此类文件或目录第26行的postaddata.php
警告:move_uploaded_file()[function.move-uploaded-file]:无法移动' C:\ Windows \ Temp \ php205.tmp'到' mycar / uploads / car001.jpg'在第26行的E:\ inetpub \ vhosts \ astradingcompany.org \ httpdocs \ mycar \ postaddata.php
这是代码sippet
if ($_FILES['file']['error'] === UPLOAD_ERR_OK)
{
if((($_FILES['file']['type'] == 'image/gif')
|| ($_FILES["file"]['type'] == 'image/jpg')
|| ($_FILES["file"]['type'] == 'image/png')
|| ($_FILES["file"]['type'] == 'image/jpeg'))
//&& ($_FILES["file"]['size'] < 20000)
&& (in_array($extensions, $allowedextensions)))
{
if (file_exists("mycar/uploads/". $_FILES['file']['name']))
{
$msg = $_FILES['file']['name']. "<b> <font face='Verdana, Geneva, sans-serif' color='red'>File Already Exists</font></b>";
header('Location:postad.php?msg='.$msg);
}
else
{
// $filename = "mycar/uploads/" .$_FILES['file']['name'];
move_uploaded_file($_FILES['file']['tmp_name'], "mycar/uploads/" . $_FILES['file']['name']);
// is_uploaded_file($_FILES['file']['tmp_name']), "uploads/" . $_FILES['file']['name'];
// is_uploaded_file($_FILES['file']['tmp_name'],"uploads/" . $_FILES['file']['name']);
// copy($_FILES['file']['tmp_name'], $uploaddatafile);
// copy($_FILES['file']['tmp_name'], $filename);
答案 0 :(得分:0)
创建一个名为uploads的目录,并确保服务器确实可以写入必要的chmod priveleges。在某些情况下,根据服务器配置,目录可能还需要足够的所有权,例如www-data
答案 1 :(得分:0)
请检查How to fix PHP upload file inherit permissions error using Windows IIS Server。感谢Garon,对我来说也有同样的问题。