What I want to do: Have the user click a link, it goes to a function also with a GET for file ext and file id(id is what it is named on the server). That function then opens that file in a new tab or downloads it if it cant be opened.
What I’ve Tried: Codeigniters read_file() function.
Also:
header('Content-type: application/pdf');
header('Content-Disposition: attachment; filename="1.pdf"');
readfile('1.pdf');
but that doesn’t work. Or it does and i dont know how to configure it properly.
Where the files are: There is a folder named uploads. The uploads and the application folder for codeigniter are on the same level.
I’m using codeigniter. The files are either, gif, jpg, or pdf. Thanks
if you want a new window:
or just a redirect: