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
    Jul 2007
    Location
    FL, USA
    Posts
    153
    Thanks
    13
    Thanked 0 Times in 0 Posts

    error with upload php file...

    I have a very simple php file that uploads a file to the server, but I'm getting errors, the upload dir on the server has the right permissions.......this is windows server running IIS 6.. here's the code
    PHP Code:
    <html>
    <body>
    <h3>File upload results.</h3>
    <?php
    //where files are goint to be uploaded
    $file_dir "C:\Inetpub\wwwroot\upload";

    foreach(
    $_FILES as $file_name => $file_array) {
        print 
    "Path: ".$file_array['tmp_name']."<br>\n";
        print 
    "Name: ".$file_array['name']."<br>\n";
        print 
    "Type: ".$file_array['type']."<br>\n";
        print 
    "Size: ".$file_array['size']."<br>\n";

    if (
    is_uploaded_file($file_array['tmp_name'])){
        
    move_uploaded_file($file_array['tmp_name'],
            
    "$file_fir/$file_array[name]") or die ("couldn't copy");
        print 
    "file was moved!<br><br>";
       }
    }
    ?>
    </body>
    </html>
    if some one could give me a hand as to why the file it's not been uploaded

    thanks

    www.pctechtips.org

  • #2
    Regular Coder
    Join Date
    Jul 2007
    Location
    FL, USA
    Posts
    153
    Thanks
    13
    Thanked 0 Times in 0 Posts
    ok guys I found it reading my own code....the error was in this line
    PHP Code:
    "$file_fir/$file_array[name]") or die ("couldn't copy"); 
    I misspelled the variable $file_dir, anyway the editor I'm using is Notepad++, which is open source, and it won't correct if you misspelled something... does anyone know of a decent editor that does some kind of error checking


    thanks

    www.pctechtips.org


  •  

    Posting Permissions

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