how to download a file without display download request
Usually when we try to download something from a server we get a confirmation request whether you want to save the file or open it.
To avoid this request you can use the below code and then user can directly download that file without any message.
First give a link or a button for user to download and when they click redirect them to a file which will have the code below.
suppose you want user to download a pdf file then first make a link like this:
<a href=”javascript:void();” onClick=”location.href=’doc/document_download.php’”>download pdf</a>
Tags: attachment, Content type, Content-Disposition, direct download, download, file, filename, pdf download, Php
