0

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?

9
  • How are you "saving" the file? You're describing a server-side save, but the header you mention is for sending the file to the client. The two are very different things. Commented Sep 13, 2013 at 13:36
  • I want the file to be saved to the client side. Commented Sep 13, 2013 at 13:42
  • What other headers are you sending (and since when was .m4v an Excel file extension)? Commented Sep 13, 2013 at 13:43
  • As I said, the m4v was just because I pasted it from somewhere else. Obviously I want .xlsx or .xls. Commented Sep 13, 2013 at 13:43
  • 1
    @snowfi6916 What will you do if someone has JS disabled? Your new solution won't work and you'll be back here again, asking for help. Commented Sep 13, 2013 at 14:51

1 Answer 1

1

you can use

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

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

Sign up to request clarification or add additional context in comments.

1 Comment

the file is simpty downloaded, no save us appears.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.