$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();
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;