Force download of image |
Hi , sorry for english , i want create a link to download image and pdf from server folder .
This is the code : Code: <?= $v->nome_file_originale ?><a download="<?= $v->nome_file_originale ?>" href="<?=base_url() ?>/uploaded/xyz_xrh/documenti/<?=$record->id_users?>/<?= $v->nome_file ?>" >Download</a> it work only with pdf ...
Please read the CodeIgniter 4 User Guide.
CodeIgniter 4 User Guide - Force File Download What did you Try? What did you Get? What did you Expect?
Joined CodeIgniter Community 2009. ( Skype: insitfx )
pippuccio76 use base_url, so it seems files stored in public folder, it is enough for him to give away a picture using a web server. Not build response from img.
(10-15-2021, 12:46 AM)InsiteFX Wrote: Please read the CodeIgniter 4 User Guide. But i must use it on an html page not redirect to another page .... is there a way to use an anchor ? (10-15-2021, 01:11 AM)ARAmiss Wrote: pippuccio76 use base_url, so it seems files stored in public folder, it is enough for him to give away a picture using a web server. Not build response from img. base_url work only to show image not to download....
According to this you just need to add the download attribute.
How to force a file to download instead of open in the browser using only HTML Chrome will not allow cross orgin downloads. What did you Try? What did you Get? What did you Expect?
Joined CodeIgniter Community 2009. ( Skype: insitfx )
But which is the correct path ? the file is in /uploaded , at the same level i have the codeigniter folder (inside there are app,system,vendor and writable) . i try FCPATH ,base_url() but dont work...
|
Welcome Guest, Not a member yet? Register Sign In |