开发者

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

开发者 https://www.devze.com 2023-03-27 01:19 出处:网络
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 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 lo开发者_Python百科cation choosed by a save file dialog.

How can I do it?

Thank you so much.


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消