"Fred Pacquier" <[EMAIL PROTECTED]> wrote:
> Content-type: application/octet-stream
> Content-Disposition: attachment;filename=foo.bar
I'm just curious -- does that filename work? I.e., if you access the
URL http://something.com/getfile?foo.bar, and you set the
Content-Disposition header, will the browser suggest foo.bar for the
filename? (Usually it would suggest getfile, I think)
> 2) Now I understand Ian's previous remark :
> "I'm not sure how you'd download several files at a time, but doing
> one file is fairly easy -- if you want, you could zip several files and
> download the zip file to the user."
>
> If I loop the above code over a list of files, I get only one download
> dialog in the browser (for the first file), and the downloaded file is
> the concatenation of all the source files... I've tried clearing the
> headers before sending each file, but that's probably not that
> function's function :)
> Is there any way around this ?
Not easily. You could use JavaScript, and do
window.open(url_for_file) for each file. You'd end up with a bunch of
empty windows after you were done, though. Perhaps you could set an
event handler for those windows which would close it onLoad, and maybe
it would close the window after the user went through the Save
As... dialog, or maybe after they finished the download. It would
require lots of experimentation, as all JavaScript does, which is why
JavaScript is so annoying :)
> Oh, and a final question : it looks like the Webkit server reads the
> entire file in memory before it starts the download. If so, this can
> become a problem with large files... Would "chunking" the file
> read/write (as in the "shutil" module) be enough to avoid that ?
See Chuck's comments. Just chunking it for .read() wouldn't be
enough, as Page also keeps the output contents in memory until your
finished unless you do streaming. I.e., self.write() doesn't (by
default) immediately write out to the adapter/web server/browser.
Ian
_______________________________________________
Webware-discuss mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/webware-discuss