PHP file upload

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • fernandodonster
    New Member
    • Aug 2006
    • 1

    PHP file upload

    How we upload movie files with php?
  • vssp
    Contributor
    • Jul 2006
    • 268

    #2
    Use this code to upload any files

    <?php
    // In PHP earlier then 4.1.0, $HTTP_POST_FILE S should be used instead of
    // $_FILES. In PHP earlier then 4.0.3, use copy() and is_uploaded_fil e()
    // instead of move_uploaded_f ile

    $uploaddir = '/var/www/uploads/';
    $uploadfile = $uploaddir. $_FILES['userfile']['name'];

    print "<pre>";
    if (move_uploaded_ file($_FILES['userfile']['tmp_name'], $uploadfile)) {
    print "File is valid, and was successfully uploaded. ";
    print "Here's some more debugging info:\n";
    print_r($_FILES );
    } else {
    print "Possible file upload attack! Here's some debugging info:\n";
    print_r($_FILES );
    }
    print "</pre>";

    ?>

    Comment

    Working...