Uploader Installation Guide

The following guide shows the steps to implement Uploader into PHP applications.

The following guide shows the steps to implement Uploader Control into PHP applications. If you haven't downloaded the software, please download it from here.

  • 1

    Deploying Uploader Client files.

    The "phpuploader" folder and all file it contains (located in the archive) should be deployed to http://{your site}/{your application}/phpuploader/ on your web site.

  • 2

    Adding Uploader into PHP page.

    1. //Step 1: Register Uploader component to your page   
    2. <?php require_once "phpuploader/include_phpuploader.php" ?>   
    3. <html>   
    4. <body>   
    5.         <form id="form1" method="POST" action="upload.php">   
    6.             <?php   
    7.                 //Step 2: Create Uploader object.   
    8.                 $uploader=new PhpUploader();   
    9.                 //Step 3: Set a unique name to Uploader   
    10.                 $uploader->Name="myuploader";    
    11.                 //Step 4: Render Uploader   
    12.                 $uploader->Render();   
    13.             ?>   
    14.         </form>   
    15. </body>   
    16. </html>  

    This form sends data to the file "upload.php", which is what we will be creating next to actually upload the file.

  • 3

    Saving the Uploaded File.

    The "upload.php" file contains the code for uploading a file. When the uploader.php file is executed, the uploaded file exists in a temporary storage area on the server. If the file is not moved to a different location it will be removed! To store the uploaded file we need to copy it to a different location using CopyTo or MoveTo method.

    1. //Step 1: Register Uploader component to your page   
    2. <?php require_once "phpuploader/include_phpuploader.php" ?>   
    3. <html>   
    4. <body>   
    5. <?php   
    6. //Gets the GUID of the file based on uploader name   
    7. $fileguid=@$_POST["myuploader"];   
    8. if($fileguid)   
    9. {   
    10.     //get the uploaded file based on GUID   
    11.     $mvcfile=$uploader->GetUploadedFile($fileguid);   
    12.     if($mvcfile)   
    13.     {   
    14.         //Gets the name of the file.   
    15.         echo($mvcfile->FileName);   
    16.         //Gets the temp file path.   
    17.         echo($mvcfile->FilePath);   
    18.         //Gets the size of the file.   
    19.         echo($mvcfile->FileSize);    
    20.            
    21.         //Copys the uploaded file to a new location.   
    22.         $mvcfile->CopyTo("/uploads");   
    23.         //Moves the uploaded file to a new location.   
    24.         $mvcfile->MoveTo("/uploads");   
    25.         //Deletes this instance.   
    26.         $mvcfile->Delete();   
    27.     }   
    28. }   
    29. ?>  
    30. </body>   
    31. </html>  

Trusted by

15,000 Customers

PHP Uploader has more than 15,000 customers, and has been sold in over 60 countries.

23 languages are supported, and more are being added.