Error while uploading image

Discussion in 'PHP' started by satish veeravalli, Aug 26, 2012.

  1. #1
    Hi,

    I am new to this forum, I have a open source website with php code and I am getting the below error when uploading image.

    Fatal error: Uncaught exception 'Exception' with message '/var/chroot/home/content/02/9689402/html/oc-content/uploads/119.jpg does not exist!' in /home/content/02/9689402/html/oc-includes/osclass/classes/ImageResizer.php:34 Stack trace: #0 /home/content/02/9689402/html/oc-includes/osclass/classes/ImageResizer.php(28): ImageResizer->__construct('/var/chroot/hom...') #1 /home/content/02/9689402/html/oc-includes/osclass/ItemActions.php(1273): ImageResizer::fromFile('/var/chroot/hom...') #2 /home/content/02/9689402/html/oc-includes/osclass/ItemActions.php(201): ItemActions->uploadItemResources(Array, 278) #3 /home/content/02/9689402/html/item.php(140): ItemActions->add() #4 /home/content/02/9689402/html/index.php(91): CWebItem->doModel() #5 {main} thrown in /home/content/02/9689402/html/oc-includes/osclass/classes/ImageResizer.php on line 34

    Its a free classified website
    iclassads.com

    Thanks,
    satish
     
    satish veeravalli, Aug 26, 2012 IP
  2. fastestsms

    fastestsms Greenhorn

    Messages:
    72
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    6
    #2

    /var/chroot/home/content/02/9689402/html/oc-content/uploads/119.jpg
    Please check this path on your server to make sure that image exists? If it's an uploading script, maybe the uploading is failed or uploaded destination is incorrect so the script cannot resize your uploaded image.
     
    fastestsms, Aug 26, 2012 IP
  3. satish veeravalli

    satish veeravalli Greenhorn

    Messages:
    5
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    11
    #3
    Hi,
    Thanks for the reply, I have checked in ftp and the file does not exists. This error is getting while uploading image to the post.

    satish
     
    satish veeravalli, Aug 26, 2012 IP
  4. fastestsms

    fastestsms Greenhorn

    Messages:
    72
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    6
    #4
    make sure that you change permission of upload to writtable( like chmod 777 /var/chroot/home/content/02/9689402/html/oc-content/uploads) and try again?
     
    fastestsms, Aug 26, 2012 IP
  5. satish veeravalli

    satish veeravalli Greenhorn

    Messages:
    5
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    11
    #5
    Hi,

    I have already set the permission to 777 for uploads folder, still no luck.

    Thanks,
    Satish
     
    satish veeravalli, Aug 26, 2012 IP
  6. Web Solutions

    Web Solutions Peon

    Messages:
    64
    Likes Received:
    1
    Best Answers:
    5
    Trophy Points:
    0
    #6
    Is that path valid ? I doubt your home directory is under /var/chroot.
     
    Web Solutions, Aug 26, 2012 IP
  7. satish veeravalli

    satish veeravalli Greenhorn

    Messages:
    5
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    11
    #7
    Hi,
    On ftp i see /oc-content/uploads(I log-in with my host ip, username password). I do not see any /var/chroot.

    Thanks
     
    satish veeravalli, Aug 26, 2012 IP
  8. fastestsms

    fastestsms Greenhorn

    Messages:
    72
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    6
    #8
    it's normal if you can't see that /var/chroot/, normal ftp user doesn't have right to see that.

    -something wrong with your php code that won't allow image to be uploaded. Upload your code here.
    -false destination folder in upload settings? try to search for some upload destination setting and change it to the path above.
     
    fastestsms, Aug 26, 2012 IP
  9. mastjaat

    mastjaat Member

    Messages:
    64
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    36
    #9
    tRY THIS ONE

    <?php
    $target_path = "uploads/";
    $target_path = $target_path . basename( $_FILES['uploadedFile']['name']);

    if(move_uploaded_file($_FILES['uploadedFile']['tmp_name'], $target_path))
    {
    echo "The file ". basename($_FILES['uploadedFile']['name']). " has been uploaded";
    }
    else
    {
    echo "There was an error uploading the file, please try again!";
    }
    ?>
     
    mastjaat, Aug 29, 2012 IP
  10. malky66

    malky66 Acclaimed Member

    Messages:
    3,997
    Likes Received:
    2,248
    Best Answers:
    88
    Trophy Points:
    515
    #10
    Don't be bloody ridiculous, whatever you do don't use this code without at least checking what type of file people are uploading, you will be hacked before you know it,
     
    malky66, Aug 29, 2012 IP