php - Why Response::download() won't download anything except PDF in Laravel 4? -


this line of code giving me sick.

return response::download(storage_path().'/file/' . $file->id . "." . $file->file->extension); 

the files uploaded , given id saved under e.g. 25.pdf works fine if file pdf doesn't else e.g. png. upgraded laravel 3 4 try overcome problem.

any ideas?

edit: uploaded test text file word test in once uploaded , downloaded opened it, there 3 blank lines , letters te!!!!!i downloaded through sftp , file correctly stored on server defiantly download procedure!

i used function instead of of laravel stuff. :/ (stolen other places around web)

public static function big_download($path, $name = null, array $headers = array()) {     if (is_null($name))         $name = basename($path);     $finfo = finfo_open(fileinfo_mime_type);      $pathparts = pathinfo($path);     // prepare headers     $headers = array_merge(array(         'content-description' => 'file transfer',         'content-type' => finfo_file($finfo, $path),         'content-transfer-encoding' => 'binary',         'expires' => 0,         'cache-control' => 'must-revalidate, post-check=0, pre-check=0',         'pragma' => 'public',         'content-length' => file::size($path),         'content-disposition' => 'inline; filename="' . $name . '.' . $pathparts['extension'] . '"'             ), $headers);     finfo_close($finfo);      $response = new symfony\component\httpfoundation\response('', 200, $headers);      // if there's session should save     if (config::get('session.driver') !== '') {         session::save();     }      // below http://uk1.php.net/manual/en/function.fpassthru.php comments     session_write_close();     ob_end_clean();     $response->sendheaders();     if ($file = fopen($path, 'rb')) {         while (!feof($file) , (connection_status() == 0)) {             print(fread($file, 1024 * 8));             flush();         }         fclose($file);     }      // finish off, laravel     event::fire('laravel.done', array($response));     $response->foundation->finish();      exit; } 

Comments

Popular posts from this blog

c++ - Creating new partition disk winapi -

Android Prevent Bluetooth Pairing Dialog -

VBA function to include CDATA -