All pastes #1621792 Raw Edit

phpuploader

public php v1 · immutable
#1621792 ·published 2009-10-15 09:54 UTC
rendered paste body
//Step 1: Register Uploader component to your page    <?php require_once "phpuploader/include_phpuploader.php" ?>    <html>    <body>            <form id="form1" method="POST">                <?php                    //Step 2: Create Uploader object.                    $uploader=new PhpUploader();                    //Step 3: Set a unique name to Uploader                    $uploader->Name="myuploader";                     //Step 4: Render Uploader                    uploader->Render();                ?>            </form>    </body>    </html>  <?php    //Gets the GUID of the file based on uploader name    $fileguid=@$_POST["myuploader"];    if($fileguid)    {        //get the uploaded file based on GUID        $mvcfile=$uploader->GetUploadedFile($fileguid);        if($mvcfile)        {            //Gets the name of the file.            echo($mvcfile->FileName);            //Gets the temp file path.            echo($mvcfile->FilePath);            //Gets the size of the file.            echo($mvcfile->FileSize);                         //Copys the uploaded file to a new location.            $mvcfile->CopyTo("/uploads");            //Moves the uploaded file to a new location.            $mvcfile->MoveTo("/uploads");            //Deletes this instance.            $mvcfile->Delete();        }    }    ?>