PHP Classes

File: index.php

Recommend this page to a friend!
  Classes of Jannerel Roche   PHP Simple Upload   index.php   Download  
File: index.php
Role: Example script
Content type: text/plain
Description: sample usage php file
Class: PHP Simple Upload
Process files for upload and download
Author: By
Last change:
Date: 15 years ago
Size: 1,244 bytes
 

Contents

Class file image Download
<?

define
(MAX_FILE_SIZE, 1000000);

include
"CLS_UPLOAD.php";
include
"CLS_DOWNLOADS.php";

$err = '';




if(isset(
$_REQUEST['submit'])) {
   
$postname = 'upload';
   
$uploaddir = 'uploads';
   
$validext = array("application/msword", "application/vnd.openxmlformats-officedocument.wordprocessingml.document","image/gif","image/pjpeg", "image/jpg","image/jpeg", "image/png");
   
$newupload = new CLS_UPLOAD($postname, $uploaddir, '', $validext); //default accepted file extension is file, unless image is specified
   
if($res = $newupload->setUpload()) {$fileup = $newupload->getNewFileN(); $newupload->converttohtml(); }
}

?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>

<body>
<?=(isset($newupload->errmsg)?$newupload->errmsg:"")?>
<form method="post" enctype="multipart/form-data" >
<input type="hidden" name="MAX_FILE_SIZE" value="<?=MAX_FILE_SIZE?>" />
<input type="file" name="upload" />
<input type="submit" name="submit" value="submit" />
</form>
 </body>
</html>