小编Jam*_* R.的帖子

move_uploaded_file()错误

我有一个免费托管网站 - 000webhost.com,它允许您上传图像.

但是,当我尝试上传图片时,我收到以下错误:

警告:move_uploaded_file(images/SmallSmileyFace.jpg)[function.move-uploaded-file]:无法打开流:第76行/home/a6621074/public_html/m/write.php中的权限被拒绝

警告:move_uploaded_file()[function.move-uploaded-file]:无法在第76行的/home/a6621074/public_html/m/write.php中将'/ tmp/phpcmW3mo'移动到'images/SmallSmileyFace.jpg'

这是代码:

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)"; …
Run Code Online (Sandbox Code Playgroud)

php

1
推荐指数
1
解决办法
6270
查看次数

标签 统计

php ×1