Well, I read the "Questions on the topic" section well, and I did not find the answer.
I am using an ajax request to force php to load . Everything works fine at the end of PHP. Say I have a data stream called DATA . Now I want to open the "Save As ..." dialog.
The browser received a string of hexadecimal values. Now, what should I do with this DATA on the client side (javascript)?
This is the PHP code I'm using, from the link above:
header('Content-type: application/octet-stream'); header('Content-Disposition: attachment; filename=$file'); readfile($file);
I tried
- window.open (
DATA ) -> hex stream does not exist (of course) - represents a form with an action like
DATA same problem
BTW. If I repeat the file with PHP, then use window.open, it works sometimes. But not for txt files or jpg, etc.
I saw how it works on other sites - how do they do it? Thanks in advance.
source share