From 42c62cb041a2b2b95c9cda0c20fcf70334fd244c Mon Sep 17 00:00:00 2001 From: deva Date: Tue, 1 Nov 2011 09:32:21 +0000 Subject: Rewl og krat... needs cleaning up - after port to GIT. --- forum/utils/filehandler.php | 59 ++++++++++++++++++++++++--------------------- 1 file changed, 31 insertions(+), 28 deletions(-) (limited to 'forum/utils/filehandler.php') diff --git a/forum/utils/filehandler.php b/forum/utils/filehandler.php index af1c305..4c18c38 100644 --- a/forum/utils/filehandler.php +++ b/forum/utils/filehandler.php @@ -1,36 +1,39 @@ 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 == "upload") { -if($task == "delete" && $fid) { - $files->deleteFile($fid); -} + 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 $str .= "File is too big " . sprintf("%.0f", filesize($_FILES['userfile']['tmp_name'])/1024). + "kb, max file size: " . sprintf("%.0f", $FILE_MAX_SIZE/1024) . "kb."; + krsort($files->files); + } + } + + if($task == "delete" && $fid) { + $files->deleteFile($fid); + } + + $str .= "
"; + $str .= "

File:

\n"; + $str .= "

Use alternative filename (leave empty to use original filename):

\n"; + $str .= "

"; + $str .= "
"; -$files->show(); + $str .= $files->show(); -?> -
-

- File: -

-

- Use alternative filename (leave empty to use original filename): - -

-

- -

-
+ return $str; +} \ No newline at end of file -- cgit v1.2.3