<?php
/********************************************
Example Usage: Multiple file uploading
*********************************************/
error_reporting(E_ALL);
if (! isset($_POST['Submit'])) {
?> <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post" enctype="multipart/form-data"> <input type="hidden" name="MAX_FILE_SIZE" value="1000000000" /> <input type="file" name="file1" /><br /> <input type="file" name="file2" /><br /> <input type="file" name="file3" /><br /> <input type="submit" name="Submit" /> </form> <?php
} else { // Include the class file require_once('Upload.class.php'); for ($x = 1; $x <= 3; $x++) { $upload = new Upload('file'.$x,'C:/'); // Max file size $upload->setMaxFileSize(10,UPLOAD_SIZE_MBYTES); // Array of valid extensions // Use * to allow all files $upload->setTypes(array('*')); // Upload the current file $process = $upload->process(); if (! $process) { echo $upload->getMessage().'<br />'; } else { echo 'File '.$x.' Uploaded...<br />'; echo 'Size: '. $upload->getFileSize().'MB<br /><br />'; } } }
?>
|