move_uploaded_file() error
<p>I have a website on free hosting - 000webhost.com and it allows you to upload images.</p>

<p>However, when I try to upload an image, I get these errors:</p>

<p>Warning: move_uploaded_file(images/SmallSmileyFace.jpg) [function.move-uploaded-file]: failed to open stream: Permission denied in /home/a6621074/public_html/m/write.php  on line 76</p>

<p>Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move '/tmp/phpcmW3mo' to 'images/SmallSmileyFace.jpg' in /home/a6621074/public_html/m/write.php  on line 76</p>

<p>This is the code:</p>

<pre><code>if (!empty($_FILES['fileImage']['name'])) {
  // check image type and size
  if ((($imagetype == 'image/gif') || ($imagetype == 'image/jpeg') || ($imagetype == 'image/pjpeg') || ($imagetype == 'image/png'))
    &amp;&amp; ($imagesize &gt; 0) &amp;&amp; ($imagesize &lt;= 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 '&lt;p&gt;Thank you for your submission!&lt;/p&gt;';
        }
        else {
            echo '&lt;p class="errmsg"&gt;There was a problem uploading your image.&lt;/p&gt;';
        }
    }
    @unlink($_FILES['fileImage']['tmp_name']);
  }
 else {
      echo '&lt;p class="errmsg"&gt;The screen shot must be a GIF, JPEG, or PNG image file no greater than 32KB in size.&lt;/p&gt;';
  }
}
</code></pre>

<p>Any ideas?</p>
