我有一个免费托管网站 - 000webhost.com,它允许您上传图片。move_uploaded_file()错误
然而,当我尝试上传图片,我得到这些错误:
警告:move_uploaded_file(图片/ SmallSmileyFace.jpg)function.move上传文件]:未能打开流:权限被拒绝in /home/a6621074/public_html/m/write.php on line 76
Warning:move_uploaded_file()[function.move-uploaded-file]:无法将'/ tmp/phpcmW3mo'移动到'images/SmallSmileyFace。 jpg'in /home/a6621074/public_html/m/write.php on line 76
这是代码:
if (!empty($_FILES['fileImage']['name'])) {
// check image type and size
if ((($imagetype == 'image/gif') || ($imagetype == 'image/jpeg') || ($imagetype == 'image/pjpeg') || ($imagetype == 'image/png'))
&& ($imagesize > 0) && ($imagesize <= 32768)) {
if ($_FILES['fileImage']['error'] == 0) {
//move file
$target = 'images/' . $image;
if (move_uploaded_file($_FILES['fileImage']['tmp_name'], $target)) {
$query = "INSERT INTO reviews (post_date, food_name, location, cafeteria, review, image, rating, user_id)
VALUES (NOW(), '$foodname', '$location', '$cafeteria', '$review', '$image', $rate, $id)";
mysqli_query($dbc, $query);
//confirm success
echo '<p>Thank you for your submission!</p>';
}
else {
echo '<p class="errmsg">There was a problem uploading your image.</p>';
}
}
@unlink($_FILES['fileImage']['tmp_name']);
}
else {
echo '<p class="errmsg">The screen shot must be a GIF, JPEG, or PNG image file no greater than 32KB in size.</p>';
}
}
任何想法?
我如何将它设置为0777?图像文件夹是我上传到主机的东西。 我不知道如何更改图像/绝对服务器路径? 对不起,如果这听起来很愚蠢,我真的很新。 – 2010-04-10 02:06:36
你的ftp程序应该有一个功能,允许你将权限设置为0777 – bumperbox 2010-04-10 02:25:12
,谢谢你的工作。 – 2010-04-10 02:45:51