CodeIgniter Forums
force_download return corrupt file - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24)
+--- Thread: force_download return corrupt file (/showthread.php?tid=63746)



force_download return corrupt file - arba - 12-06-2015

Here my code. It is success to download the file, but the file is corrupt. is it a bug ? or i miss something ? i use CI 3.x.
Many thanksĀ  Smile

Code:
$filename = 'something.docx';
$name = '/path/files/'.$filename.'';
        force_download($filename, $name);



RE: force_download return corrupt file - includebeer - 12-06-2015

You parameters are wrong.

PHP Code:
// Contents of photo.jpg will be automatically read
force_download('/path/to/photo.jpg'NULL); 

See : http://www.codeigniter.com/user_guide/helpers/download_helper.html#force_download