Uploader

pfgannonpfgannon ModeratorAdministrator
I need a script so that people working on my site can upload a pretty large file about 42 MB.

anyone know of a good free script that i can use?

Comments

  • ForgeForge Senior Member The Royal RAM
    What coding language? PHP, ASP? Other?
    Can fat people Go skinny Dipping?
  • mattematte Beginner Link Clerk
    I also have one that is looking very cool!
  • CheaterCheater Beginner Link Clerk
    Here is a PHP script I found. Call it upload.php

    <?php
    //======================
    // Author: TeeJay
    //
    // Date: 09-2002
    //
    // Description:
    // This function takes the input given by
    // the user and processes it.
    // From the moment that the user presses submit
    // a temorary file is stored in a temporary directory
    // specified by upload_tmp_dir on your php.ini,
    // then we get it's size and check to see that is not
    // greater than the MAX_FILE_SIZE specified on the form.
    // If it is all ok up to now, it makes a copy of the temp
    // file to the specified new directory.
    //======================

    $new_dir = "uploads/";

    if(!is_dir($new_dir)) echo "<font color=red>Please first create the <b>$new_dir</b> folder(s) to store the uploads.</font>";

    function handleupload() {
    global $new_dir;
    // Check if it was infact uploaded - by using
    if (is_uploaded_file($_FILES)) {
    echo "<br />";
    // Check it's size
    if($_FILES <= $_POST) {
    // get it's real name
    $realname = $_FILES;
    // Attempt to copy to users/ <-- Make sure this folder exists already
    if(copy($_FILES, $new_dir.$realname)) {
    echo "<br /><font color=\"green\"><b>$realname</b> was successfuly uploaded. To view it, go to http://yoursite.com/uploads/$realname</font>";
    }else {
    //this is probably because the directory does not exist yet
    echo "<br /><font color=\"red\"><b>$realname</b> could not be successfuly uploaded</font>";
    }

    }else {
    // the file to upload exceeds the specified MAX_FILE_SIZE
    echo "<br />The File size exceeded the ".($_POST/1024)."kb max file size allowed.<br />";
    }
    } else {
    // File is greater than the upload_max_filesize set on your php.ini
    echo "<br />Possible file upload attack: filename ".$_FILES.".";
    }
    }

    ?>
    <html>
    <head>
    <title>File Upload</title>
    </head>
    <body>
    <?php
    // When the user clicks on the submit/upload button
    // this statement becomes true and the handleupload
    // function is called.
    if(isset($_POST)) {
    handleupload();
    }
    ?>
    <!-- Make sure to add this: ENCTYPE="multipart/form-data" to your <form> tag for it to work -->
    <form ENCTYPE="multipart/form-data" method="POST" action="upload.php">
    File:<INPUT TYPE="FILE" NAME="userfile" SIZE="35">
    <input type="hidden" name="MAX_FILE_SIZE" value="102400"> <!-- This is the max file size and can be changed -->
    <input type="submit" value="Upload" name="submit"><input type="reset" value="Clear Form" name="reset">
    <br />Please click only <b>once</b> and wait for confirmation
    </form>
    </body>



    </html>
Sign In or Register to comment.