PHP Classes

File: example_for_single_file_upload.php

Recommend this page to a friend!
  Classes of MOUSTAFA ELGAMMAL   PHP Multi File Uploader   example_for_single_file_upload.php   Download  
File: example_for_single_file_upload.php
Role: Example script
Content type: text/plain
Description: single dile example
Class: PHP Multi File Uploader
Validate and process one or more file uploads
Author: By
Last change:
Date: 8 years ago
Size: 833 bytes
 

Contents

Class file image Download
<form action="example_for_single_file_upload.php" method="post" enctype="multipart/form-data">
    <input type="file" name="file" />
    <input type="submit" name="submit" value="upload" />
   
</form>
<hr>

<?php
require_once 'classes/upload.class.php';

$up = new uploader ();

if (isset (
$_POST ['submit'] )) {
   
// give it FILES array with input name
   
$up->Upload_Init ( $_FILES ['file'] );
   
   
// Set Upload directory >>if not found it will be created
   
$up->Upload_Set_dir ( 'uploads/single' );
   
   
// set allowed mime type
   
$up->Upload_Set_Type ( array (
           
'image/jpg',
           
'image/jpeg',
           
'image/png',
           
'image/gif'
   
) );
   
   
// set allowed extensions
   
$up->Upload_Set_Ext ( array (
           
'jpg',
           
'jpeg',
           
'gif',
           
'png'
   
) );
   
   
// Process uploading
   
$upimg = $up->Upload ();
}
?>