aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCash Costello <cash.costello@gmail.com>2011-06-24 03:59:22 -0700
committerCash Costello <cash.costello@gmail.com>2011-06-24 03:59:22 -0700
commit344e47862b1f39eca19e39a000f97f799cc87a12 (patch)
tree136b4f69afcc60da387bb84fbc74d7a049b32e42
parent60d69e25433b7b00d9c7f20db43b71c8978560c9 (diff)
parentd9485cb8e8982c668d7aa374f80ad2fa4c93753d (diff)
downloadelgg-344e47862b1f39eca19e39a000f97f799cc87a12.tar.gz
elgg-344e47862b1f39eca19e39a000f97f799cc87a12.tar.bz2
Merge pull request #33 from mcloughlin3/master
Fix bug #1932
-rw-r--r--mod/file/actions/file/upload.php3
-rw-r--r--mod/file/download.php9
2 files changed, 6 insertions, 6 deletions
diff --git a/mod/file/actions/file/upload.php b/mod/file/actions/file/upload.php
index 5d5c28bee..c5fe763cb 100644
--- a/mod/file/actions/file/upload.php
+++ b/mod/file/actions/file/upload.php
@@ -106,9 +106,10 @@ 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 guarantee the directory exists
$file->open("write");
- $file->write(get_uploaded_file('upload'));
$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;