Login   Register  
PHP Classes
elePHPant
Icontem

File: example.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Szymon Lukaszczyk  >  Simple Upload  >  example.php  >  Download  
File: example.php
Role: Example script
Content type: text/plain
Description: example
Class: Simple Upload
Manage files uploaded via forms
Author: By
Last change: update
Date: 2008-07-09 11:45
Size: 1,267 bytes
 

Contents

Class file image Download
<html>
<head>
<title> SimpleUpload Class Example </title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<head>
<body>
<h1> SimpleUpload Class Example</h1>
<h3>by Szymon Ćukaszczyk</h3>

<form enctype="multipart/form-data" action="example.php" method="POST">
    <input type="hidden" name="MAX_FILE_SIZE" value="30000" />
    Send this file: <input name="file" type="file" />
    <input type="submit" value="Send File" />
</form>
<pre>
<?

include_once("SimpleUpload.php");
if( isset (
$_FILES["file"])):

$upload = new SimpleUpload;
//~ $upload->setPath("./upload"); // sets uplod path to ./upload
$upload->setContents($_FILES["file"]);
//~ $upload->setRandomAddSize(false);  // no random ending
//~ $upload->setRandomAddSize(10); // 10 char random ending
//~ $upload->setMaxNameSize(10); //file without extension has 10 chars
//~ $upload->setNameFormating(false); // no cropping, no char conversion(You can have !@/ in file name)
//~ $upload->setRandomEnding(false);  // no random ending
//~ $upload->setMd5Making(false) // no md5 sum

if (!$upload->uploadFile(false))
        echo 
"Error occured";
else
{
        echo  
"Success<br/>";
        
print_r($upload->getContents());
}

endif;
?>


</pre>
</body>
</html>