Hello, what is the tag responsible for the download of the file?

Know - is it possible to do so - a href="doc.pdf" download="doc.pdf" to download a
But this method is not supported by IE, as to be with him?
July 9th 19 at 13:00
5 answers
July 9th 19 at 13:02
Set the header Content-Type: application/octet-stream.
.htaccess:
AddType application/octet-stream .pdf
IN PHP:
header('Content-Type: application/octet-stream');

// Return the desired file, e.g. echo file_get_contents(...).
// Make protection from burglary!
And where's the fix?) - eveline_Langworth54 commented on July 9th 19 at 13:05
: Um, Yes, funny. The file is given as a stream (binary file), any browser thinks it is downloading the file. - Domenick.Ste commented on July 9th 19 at 13:08
: just for me Content-Disposition: attachment; much more convenient for returns - eveline_Langworth54 commented on July 9th 19 at 13:11
: technically, we must still specify application/octet-stream. Technically. - Domenick.Ste commented on July 9th 19 at 13:14
July 9th 19 at 13:04
download
Know - is it possible to do so - a href="doc.pdf" download="doc.pdf" to download a
But this method is not supported by IE, as to be with him? - eveline_Langworth54 commented on July 9th 19 at 13:07
July 9th 19 at 13:06
using htaccess it is done and works 100% everywhere
July 9th 19 at 13:08
<a href="http://example.com/files/myfile.pdf" target="_blank">Download</a>
and browser to safely open the PDF in a new tab instead of what the author is asking) - eveline_Langworth54 commented on July 9th 19 at 13:11
don't target"blank" and instead need to put download="dawnload," and all - Domenick.Ste commented on July 9th 19 at 13:14
July 9th 19 at 13:10
Content-Disposition: attachment; filename="8431.jpg"

Find more questions by tags HTML