Create a custom upload button -- PHP File Upload

php Uploader

PHP File Uploader

Create a custom upload button

There are two simple steps to create a custom upload button:

  1. Create a HTML button or image button which will be used as custom upload button.
  2. Use the InsertButtonID property to specify the ID of the control that will be used as the upload button.

Example:

  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: Specify ID of the control that will be used as upload button.   
  12.                 $uploader->InsertButtonID="uploadbutton";   
  13.                 //Step 5: Render Uploader   
  14.                 $uploader->Render();   
  15.             ?>   
  16.             <img id="uploadbutton" alt="Upload File" src="sampleimages/upload.png" />   
  17.         </form>   
  18. </body>   
  19. </html>