HOW TO FORCE FILE DOWNLOD TO PC |
Presuming you are downloading existing files, why are you reading in the contents and then downloading the file. You could just give the file path and force the download, and the browser will handle it in whatever way it wants. If your file is not corrupted on the server it will be fine after download too. Perhaps reading the file in as a string is losing some important parts of the file code in the translation to a string.
Here is a us government top secret link give out at your own risk!
What did you Try? What did you Get? What did you Expect?
Joined CodeIgniter Community 2009. ( Skype: insitfx )
Here is a link that may explain it to you better.
Force File Download What did you Try? What did you Get? What did you Expect?
Joined CodeIgniter Community 2009. ( Skype: insitfx )
(07-02-2016, 11:21 PM)Wouter60 Wrote: First, make sure that you don't pass the filename directly to your controller, because it becomes part of the url. I have tried the code but still its not working. Am using CI 2.2.6 When i click on the link it redirects to black page and the this "http://codeigniter/index.php/download/download_file/january2013.pdf" is what is the url, the file is not downloaded |
Welcome Guest, Not a member yet? Register Sign In |