Register

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 7 of 7
  1. #1
    Junior Member
    Join Date
    Mar 2004
    Posts
    17
    Member #
    5091
    I've done a lot of searching on this forum and can't find an answer. My simple PHP file upload script will not work. The upload folder exists on the server with the correct permissions. The PHP is 4.3.10 and the php.ini file show that uploading is allowed and the max filesize is 2MB. My form has the correct enctype. Any ideas?

    PHP Code:
    // Upload document, if applicable
        
    if ($_FILES['releaseFile']) {
        
            
    $target_dir "../pdf/";
            
    $target_path $target_dir basename($_FILES['releaseFile']['name']);
        
            if (
    move_uploaded_file($_FILES['releaseFile']['tmp_name'], $target_path)) {

                print 
    "<br>\n";
                print 
    "The file has been uploaded<br>\n";
            
                
    $releaseFile basename($_FILES['releaseFile']['name']);

            } else {

                print 
    "<br>\n";
                print 
    "There was an error uploading the file<br>\n";
            }
        } 

  2.  

  3. #2
    Senior Member
    Join Date
    May 2003
    Location
    UK
    Posts
    2,354
    Member #
    1326
    Do you get the "There was an error uploading the file" message?

    1: Try strlower'ing $target_parh in the move_uploaded_file call
    2: Be sure your form element is called releaseFile
    3: Echo out $target_dir and see if it is what you expect.

    Good luck

  4. #3
    Junior Member
    Join Date
    Mar 2004
    Posts
    17
    Member #
    5091
    Yes.

    1. Tried it. Didn't work.
    2. It is.
    3. It is correct.

    Any other ideas?

  5. #4
    Junior Member
    Join Date
    Mar 2004
    Posts
    17
    Member #
    5091
    I'm thinking it has to be a path issue. It is being hosted on a Windows NT server. I'm racking my brain. Any ideas?

  6. #5
    Senior Member
    Join Date
    May 2003
    Location
    UK
    Posts
    2,354
    Member #
    1326
    PHP Code:
    move_uploaded_file($_FILES['releaseFile']['tmp_name'], "../pdf/" .strtolower($_FILES['releaseFile']['name'])); 
    Any beter?

  7. #6
    Junior Member
    Join Date
    Mar 2004
    Posts
    17
    Member #
    5091
    I had already tried this to no avail. FYI - after turning display errors on, I got this:

    Code:
    Warning: move_uploaded_file(../pdf/test_file.pdf): failed to open stream: Permission denied in O:\full\path\on\the\server\admin\release_add.php on line 33
    
    Warning: move_uploaded_file(): Unable to move '/tmp/uploads\php6729.tmp' to '../pdf/test_file.pdf' in O:\full\path\on\the\server\admin\release_add.php on line 33
    
    There was an error uploading the file
    
    Notice: Undefined variable: releaseFile in O:\full\path\on\the\server\admin\release_add.php on line 49
    Any ideas?

  8. #7
    Junior Member
    Join Date
    Mar 2004
    Posts
    17
    Member #
    5091
    LOL. I just found out that the client now wants to move to a Linux server. All issues resolved. Sorry for wasting your time. I appreciate your help!


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 12:20 AM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com