문제

I have the following code:

header('Content-type: text/plain');
header("Content-Disposition: attachment; filename=bookmark.adr");
readfile('bookmark.adr');

This makes a save-as popup where an user can save the bookmark.adr file. But I would like to custom generate the content of that file. How can I generate the content and let that file be popupped as save-as?

Thanks!

도움이 되었습니까?

해결책

Just don't do readfile(). Echo out whatever you want that file to contain instead.

Your Content-Disposition header is what will tell most browsers to prompt the user to save the file.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top