michele
michele

Reputation: 26598

save a file generated by a php script in to a directory by save dialog form

I have a php script that generate a pdf file. So I have an html page with jquery javascript that do an ajax call at this php script and retrieve the pdf file content. I would that this file will be saved in a location choosed by a save file dialog.

How can I do it?

Thank you so much.

Upvotes: 0

Views: 590

Answers (1)

Pekka
Pekka

Reputation: 449485

You don't need Ajax - just do a

location.href = "fileURL.php";

(or alternatively, have the user click on a link) and if the headers are set correctly, a download dialog will present itself.

Upvotes: 1

Related Questions