Deployment PHP File Uploader

php Uploader

PHP File Uploader

Deployment

PHP File Uploader is 100% HTML and JavaScript code on the client, and PHP code on the server, and can be setup on your web server in just 5 minutes, simply by following this setup guide.

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">   
  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>  
3. Retrieving uploaded file.
  1. <?php   
  2. //Gets the GUID of the file based on uploader name   
  3. $fileguid=@$_POST["myuploader"];   
  4. if($fileguid)   
  5. {   
  6.     //get the uploaded file based on GUID   
  7.     $mvcfile=$uploader->GetUploadedFile($fileguid);   
  8.     if($mvcfile)   
  9.     {   
  10.         //Gets the name of the file.   
  11.         echo($mvcfile->FileName);   
  12.         //Gets the temp file path.   
  13.         echo($mvcfile->FilePath);   
  14.         //Gets the size of the file.   
  15.         echo($mvcfile->FileSize);    
  16.            
  17.         //Copys the uploaded file to a new location.   
  18.         $mvcfile->CopyTo("/uploads");   
  19.         //Moves the uploaded file to a new location.   
  20.         $mvcfile->MoveTo("/uploads");   
  21.         //Deletes this instance.   
  22.         $mvcfile->Delete();   
  23.     }   
  24. }   
  25. ?>  
This control is also available for ASP.NET!

Ajax Uploader for .NET