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 2 of 2
  1. #1
    Regular Coder
    Join Date
    May 2003
    Location
    34° 54' N 82° 13' W
    Posts
    996
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Upload not working

    PHP Code:
    $uploaddir $_POST['dir'];
    $uploadfile $uploaddir $_FILES['userfile']['name'];
                
                if(empty(
    $_FILES['userfile']['name']))
                {
                    echo 
    "No file specified to upload.";
                }
                elseif(
    move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile))
                {
                    echo 
    "File was successfully uploaded!";
                }
                else
                {
                    echo 
    "File was not uploaded.";
                } 
    and my form
    PHP Code:
    <form enctype="multipart/form-data" action="<?php echo $cfg['self']; ?>" method="POST" style="margin: 0;">
                        <input type="hidden" name="MAX_FILE_SIZE" value="1073741824" />
                        <input type="file" name="userfile" style="font-size: 8pt;" size="30" />
                        <input type="submit" value="Go" name="upload" style="font-size: 8pt;" /><br />
                        <input type="hidden" name="dir" name="dir" value="<?php echo $cfg['dir']; ?>" />
                    </form>
    It fails to upload, but gives no error. Any help?
    Stevie Peele
    Neverside IRC Network - irc.veonex.net | tc.tutorialnetwork.org
    #dev - any programming,etc. question
    #design - design discussion and critque
    #central - general chat
    Come join us!

  • #2
    raf
    raf is offline
    Master Coder
    Join Date
    Jul 2002
    Posts
    6,589
    Thanks
    0
    Thanked 0 Times in 0 Posts
    i don't immedeately see anything wrong.

    my first idea would be that you have a windowsstyles dirname (with backslashes) while you upload to a *nix wich needs forwardslashes.
    or that you (well the webserver) doesn't have writepermission for the directory you write to.

    Try echoing out the adress.
    Posting guidelines I use to see if I will spend time to answer your question : http://www.catb.org/~esr/faqs/smart-questions.html


  •  

    Posting Permissions

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