snowfi6916
snowfi6916

Reputation: 697

Save File to Specific Location Using PHP

I have a PHP script that is writing an Excel file. The script is successfully writing the file, but is saving it in the same directory as the script.

I want the user to be able to see the "Save As" dialog window when they click the Download button that I have. Everything I have seen regarding how to do this in PHP has said to just add this to the PHP script:

header('Content-Disposition: attachment; filename="video.m4v"');

where "video.m4v" would be the Excel file I am downloading.

However, the "Save As" window never pops up, and it continues to save it to the same directory as the script. Can anyone please tell me how to do this?

Upvotes: 0

Views: 914

Answers (1)

Thanos Darkadakis
Thanos Darkadakis

Reputation: 1729

you can use

<a href="video.m4v" download>Click here to download</a>

be sure to include the word "download" after the filename

Upvotes: 1

Related Questions