PHP Classes

File: example.php

Recommend this page to a friend!
  Classes of steve krishna   ImageUpload   example.php   Download  
File: example.php
Role: Example script
Content type: text/plain
Description: example
Class: ImageUpload
Validate and process upload files
Author: By
Last change:
Date: 15 years ago
Size: 1,212 bytes
 

Contents

Class file image Download
<?php
if(isset($_POST['submit'])){


   if (
$_FILES && !$_FILES['input_file']['error']) {

    require_once(
'fileUpload.php');
   
$opts = (array)array();

   
$opts['file'] = 'input_file';
   
   
$imgUp = new imageUpload($opts);

    if(
$imgUp){
      if(
$imgUp->error >= 6){
        echo
"Internal error 6. Please contact admin or try again later."; //you can update log file with error for debugging
     
}else{
        echo
$imgUp->error;
      }
    }else{
        echo
"Internal error. Please contact admin or try again later."; //you can update log file with error for debugging
   
}
   }
}
?>


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<html>

<head>
<title>Sans Titre</title>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
</head>
<body bgcolor="#FFFFFF">
<?php
       
echo '<form name="join" method="POST" action="example.php" enctype="multipart/form-data">';
        echo
'<input name="input_file" type="file" value="Choose a file..." />';
        echo
'<input type="submit" name="submit" value="Submit" />';
        echo
'</form>';
?>
</body>

</html>