It must be using http headers: header('Content-Disposition: inline; filename='. $filename.'.pdf'); header('Content-type: application/x-pdf'); echo $pdfData; die();
By example. - On Jan 22, 3:05 am, Genus Project <genusproj...@gmail.com> wrote: > or you can do this. > 1. your php create the file from your post. > 2. return something to the script ($.post) that says you have > successfully created the file > or maybe with the filepath in it in json or whichever format it > is. > 3. redirect your current window to the path of this file. > > But it may show the file as is because browser can usually display a > txt file. > > I am not sure how to open up the browser dialog save us box :) > > On Jan 22, 3:46 am, AlexDeLarge <perkeleenperkelesaat...@gmail.com> > wrote: > > > Hi, > > > I have situation like this: I post certain data with $.post to PHP- > > script which is supposed to handle the data, create a file from it and > > then trigger browser to open a Save As-dialog. Everything works just > > fine except the Save As-dialog, I just can't make it pop-up. > > > For the Save As dialog the PHP-script ha s following statements: > > > header('Content-disposition: attachment; filename=stats.txt'); > > header('Content-type: text/plain'); > > readfile('stats.txt'); > > > And this just doesn't work through $.post, or at least I can't make it > > happen. > > > Is there any way to make this work?