Hello Community,
I was wondering if there is a way to goto the direct link of a file (eg. http://example.com/files/test.txt) and for it to download insted of loading and displaying the file.
I want to do this for every file in the "files" folder and only that folder.

Recommended Answers

after searching I found this

header("Content-Disposition: attachment; filename=\"" . basename($File) . "\"");
header("Content-Type: application/force-download");
header("Content-Length: " . filesize($File));
header("Connection: close");

HERE

Jump to Post

All 2 Replies

after searching I found this

header("Content-Disposition: attachment; filename=\"" . basename($File) . "\"");
header("Content-Type: application/force-download");
header("Content-Length: " . filesize($File));
header("Connection: close");

HERE

What do i add this to?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.20 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.