Login   Register  
PHP Classes
elePHPant
Icontem

File: upload.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Abdelkader Elkalidi  >  Safely Upload  >  upload.php  >  Download  
File: upload.php
Role: Example script
Content type: text/plain
Description: Code exemple
Class: Safely Upload
Validate and process uploaded files
Author: By
Last change:
Date: 4 years ago
Size: 581 bytes
 

Contents

Class file image Download
<?php
if(isset($_FILES['image']) AND is_array($_FILES['image']) AND $_FILES['image']['error'] == 0){
    require_once(
"SafelyUpload.php"); // Require SafelyUpload PHP class
    
$upload    =    new SafelyUpload($_FILES['image'],"uploads",75);
    
$upload->resize(400);    // Optional !! Resize to width = 600  if width > height || Height = 600 if height > width
    
if( $upload->upload() ){
        echo
"Photo uploaded successfully<br /><img src=\"".$upload->new_name."\" />";
    }
    else{
        echo 
$upload->error;
    }
}
else{
    echo
"You're welcome only from <a href=\"form.html\">form.html</a>";
}
?>