Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    New to the CF scene
    Join Date
    Jan 2008
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    failed to open stream:

    Hi, I have had a look at the other posts on this topic, but I can't seem to get this action to work for me...

    This is the error I get:

    Warning: move_uploaded_file(uploads/upload.jpg) [function.move-uploaded-file]: failed to open stream: No such file or directory in /home/nameofsite/public_html/forms/valuations.php on line 122

    Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move '/tmp/phpSkRat9' to 'uploads/upload.jpg' in /home/nameofsite/public_html/forms/valuations.php on line 122

    Line 122 reads as:

    Line 119 - If (is_uploaded_file($_FILES['some_file']['tmp_name'])) {
    Line 120 - $target_path = "uploads/";
    Line 121 - $target_path = $target_path . basename( $_FILES['some_file']['name']);
    Line 122 - if(move_uploaded_file($_FILES['some_file']['tmp_name'], $target_path)) {
    Line 123 - $attachment = true;
    Line 124 - } else{
    Line 125 - $error .= "There was an error uploading the file, please try again!";

    I would really appreciate some help on this. Its driving me crazy!!

  • #2
    Super Moderator JohnDubya's Avatar
    Join Date
    Nov 2006
    Location
    Missouri
    Posts
    634
    Thanks
    12
    Thanked 18 Times in 18 Posts
    Have you made completely sure that the directory exists, and you're using the right path to it? And are you sure the CHMOD permissions are set correctly? Should be 755, 777, or otherwise, depending on your security needs.

  • #3
    New to the CF scene
    Join Date
    Jan 2008
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thanks for taking the time to reply! The directory "uploads?" exists in nameofsite/public_html/uploads/ and the permissions have been set to 777. The path that is set on Line 120 - $target_path = "uploads/"; This this correct or should this be $target_path = "home/nameofsite/public_html/uploads/"; ?
    Last edited by sawtons; 01-25-2008 at 08:24 AM.

  • #4
    New to the CF scene
    Join Date
    Jan 2008
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Hey thanks JohnDubya... I've sorted it!

  • #5
    Super Moderator JohnDubya's Avatar
    Join Date
    Nov 2006
    Location
    Missouri
    Posts
    634
    Thanks
    12
    Thanked 18 Times in 18 Posts
    Quote Originally Posted by sawtons View Post
    Hey thanks JohnDubya... I've sorted it!
    No problem! You might post how you fixed it here, so if anyone has the same or similar problem, they can be helped by your experiences. Good luck!


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •