PHP force download png |
Hi;
Hi for some reason I cannot use Codeigniters force_download. I thought I learn first how to do it without CI so I can figure it out. How can I force download this png file? This one downloads a file but the file can not be opened since it's damaged! PHP Code: $image='http://clickbank.wpengine.netdna-cdn.com/wp-content/uploads/2014/12/andrea-image-compressed.png'; I also got this from the manual, but same thing, broken file: PHP Code: $image='http://clickbank.wpengine.netdna-cdn.com/wp-content/uploads/2014/12/andrea-image-compressed.png';
You can achieve that by using CI Download helper.
$this->load->helper('download'); $content = file_get_contents("http://ointuit.ru/wp-content/uploads/2014/09/PHP5.jpg"); // Read the file's contents $file_name = 'myfile.jpg'; force_download($file_name, $content); |
Welcome Guest, Not a member yet? Register Sign In |