If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 1 of 1

Thread: Up one level ..

  1. #1
    Junior Member spasm attack's Avatar
    Join Date
    Aug 2006
    Member #
    Hey, I'm trying to get a web form that will upload a file to a directory that is up one level from the folder the handler is in, but I don't know how to make it go up one level. The script is in public_html/cp/ and the place I want the file to go is in public_html/images/userimages/ . I tried uploading it to public_html/cp/images/ as a test and it worked fine, so the problem is definately with the directory I'm trying to put it in.
     $uploaddir = "../images/userimages/";
    $filename = $_FILES['userfile']['name'];
    //Then I do some stuff with the file name
    $uploadfile = $uploaddir . $filename;
    If (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile)) {
              echo "You rock";
    } Else {
              echo "You suck";
    It keeps telling me I suck along with this error:
    Warning: move_uploaded_file(../images/userimages/anipil.gif) [function.move-uploaded-file]: failed to open stream: No such file or directory in /home/marke/public_html/cp/picture.php on line 16
    Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move '/tmp/phpAnJmCm' to '../images/userimages/anipil.gif' in /home/marke/public_html/cp/picture.php on line 16
    I always thought ".." meant up one level, but appearently not in PHP. This server is Linux if it matters. Thanks for your help!

    *EDIT* - I cried wolf too soon. When I created the folder on the server I called it userpictures. NEVERMIND
    "There is no spoone" -The Matricks


Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
All times are GMT -6. The time now is 07:30 AM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: