Jump to content

Error moving converted image on webserver


nickd_101

Recommended Posts

Hi,
I've developed a website on a local PHP server, and have just uploaded it to my webspace. I have a script that resizes and uploads images to the server for display on various articles. However, when a user uploads an image file the following error is displayed:

Warning: move_uploaded_file(images/user/johnny.JPG): failed to open stream: Permission denied in /home/onestops/public_html/add_property.php on line 131

Warning: move_uploaded_file(): Unable to move '/var/tmp/phpvK4cZK' to 'images/user/johnny.JPG' in /home/onestops/public_html/add_property.php on line 131

The corresponding code is:

$imagedetails= "main";
$image_caption = $_POST['image_caption'];
$image_username = $Property_ID;
$image_tempname = $_FILES['image_filename']['name'];
$today = date("Y-m-d");
//upload image and check for image type
$ImageDir ="images/user/";

$ImageThumb = $ImageDir . "thumbs/";

$ImageName = $ImageDir . $image_tempname;
if (move_uploaded_file($_FILES['image_filename']['tmp_name'], $ImageName)) {
//get info about the image being uploaded
list($width, $height, $type, $attr) = getimagesize($ImageName);

Can anyone see any solutions to the problem, as i've had help from the space provider (startlogic) but i can't see any problem with the code?

Thanks for the help,
Nick
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.