aboutsummaryrefslogtreecommitdiff
path: root/mod/file
diff options
context:
space:
mode:
Diffstat (limited to 'mod/file')
-rw-r--r--mod/file/actions/file/upload.php3
-rw-r--r--mod/file/download.php9
2 files changed, 7 insertions, 5 deletions
diff --git a/mod/file/actions/file/upload.php b/mod/file/actions/file/upload.php
index fe93661f2..9581698be 100644
--- a/mod/file/actions/file/upload.php
+++ b/mod/file/actions/file/upload.php
@@ -106,6 +106,9 @@ if (isset($_FILES['upload']['name']) && !empty($_FILES['upload']['name'])) {
$file->originalfilename = $_FILES['upload']['name'];
$file->simpletype = file_get_simple_type($_FILES['upload']['type']);
+ // Open the file to guarentee the directory exists
+ $file->open("write");
+ $file->close();
move_uploaded_file($_FILES['upload']['tmp_name'], $file->getFilenameOnFilestore());
$guid = $file->save();
diff --git a/mod/file/download.php b/mod/file/download.php
index a386d490f..8e0287a1e 100644
--- a/mod/file/download.php
+++ b/mod/file/download.php
@@ -33,8 +33,7 @@ if (strpos($mime, "image/") !== false) {
header("Content-Disposition: attachment; filename=\"$filename\"");
}
-$contents = $file->grabFile();
-$splitString = str_split($contents, 8192);
-foreach ($splitString as $chunk) {
- echo $chunk;
-}
+ob_clean();
+flush();
+readfile($file->getFilenameOnFilestore());
+exit;