I have a PDF on my server. Now I want to open this file so the user can download it using the browser. How can I do that? I dont want to read the file or anything, its already on the server, just need to download it ...
Thanks?
I have a PDF on my server. Now I want to open this file so the user can download it using the browser. How can I do that? I dont want to read the file or anything, its already on the server, just need to download it ...
Thanks?
there are differenct options:
First: if its in your htdocs folder, just link to it ( http://example.com/myfile.pdf )
Second: you could use the x-sendfile header. it is not supported by all servers. make sure to read the docs to find out what your server provides
third: you could set the appropriate header (Content-Type, Content-Length, etc) and then read the file via the readfile function
will be download as downloaded.pdf
If you are using apache server, you can add this code to your VirtualHost config, or to your .htaccess file:
Please be more specific, is your server a web server? If so, you can simply add the pdf somewhere in your root directory and navigate to it directly in a web browser and it should automatically download.
ie http://whateveryoursiteis.com/testpdf.pdf