<?php include_once($UTIL_DIR . "/files.php"); $files = new Files($DATA_DIR . "/files.xml"); if($task == "upload") { if(is_uploaded_file($_FILES['userfile']['tmp_name'])) { $name = $filename; if(!$filename) $name = $_FILES['userfile']['name']; if(filesize($_FILES['userfile']['tmp_name']) <= $FILE_MAX_SIZE) $files->newFile($_FILES['userfile']['tmp_name'], $name); else echo "File is too big " . sprintf("%.0f", filesize($_FILES['userfile']['tmp_name'])/1024). "kb, max file size: " . sprintf("%.0f", $FILE_MAX_SIZE/1024) . "kb."; } } if($task == "delete" && $fid) { $files->deleteFile($fid); } $files->show(); ?> <form class="files" enctype="multipart/form-data" action="?mode=filehandler&task=upload" method="post"> <p> File: <input name="userfile" type="file"> </p> <p> Use alternative filename (leave empty to use original filename): <input name="filename" value="<?php echo $description ?>"/> </p> <p> <button type="submit">Add file</button> </p> </form>