]> gitweb.fluxo.info Git - lorea/elgg.git/commitdiff
Modified upload script to guarentee that the directory under elgg data is created...
authorRussell McLoughlin <mcloughlin3@llnl.gov>
Wed, 1 Jun 2011 20:16:39 +0000 (13:16 -0700)
committerRussell McLoughlin <mcloughlin3@llnl.gov>
Wed, 1 Jun 2011 20:16:39 +0000 (13:16 -0700)
mod/file/actions/file/upload.php
mod/file/download.php

index fe93661f25d0203b46fc186f7dfb18e694c5aaac..9581698be6bb340dc911cc00507fb0f57cc3b3df 100644 (file)
@@ -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();
index a386d490fb4d53485edafae244dfbded997e12ec..8e0287a1e122f705a0576430dc5423948cf0831c 100644 (file)
@@ -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;