Login   Register  
PHP Classes
elePHPant
Icontem

File: uploaddemo.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Andrew Rau  >  File Upload  >  uploaddemo.php  >  Download  
File: uploaddemo.php
Role: Example script
Content type: text/plain
Description: Example
Class: File Upload
Validate and process files uploaded with Web forms
Author: By
Last change:
Date: 2007-04-15 05:16
Size: 901 bytes
 

Contents

Class file image Download
<?php
include('i_upload.cls.php');
?>
<html>
<body>
<?php
if($_FILES['userfile']['name']!=''){
    
$file = new FileUpload();
    
$file->SetFileType(".jpg");
    echo 
"Allowable File Types: " $file->GetFileTypes() . "<br>";
    
$file->SetBadFileType(".png");
    echo 
"Unacceptable File Types: " $file->GetBadFileTypes() . "<br>";
    
$file->SetMaxFileSize("1000");
    
$file->UploadFile("userfile""""Test");
    echo 
"FileSize: " $file->GetFileSize() . "<br>";
    echo 
"Extension: " $file->GetExtension() . "<br>";
    echo 
"Filename: " $file->GetFilename() . "<br>";
    echo 
"Error: " $file->GetError() . "<br>";
}
?>
<form enctype="multipart/form-data" action="i_upload.php" method="post">
    Choose a file to upload: <input name="userfile" type="file"><br>
    <input type="submit" value="Upload File">&nbsp;&nbsp;<input type="button" value="Cancel" OnClick="Reset();">
</form>
</body>
</html>