On Tue, 19 Mar 2013 19:27:33 -0600
Larry Martell <larry.mart...@gmail.com> wrote:

> On Tue, Mar 19, 2013 at 7:07 PM, Tim Chase
> <django.us...@tim.thechases.com> wrote:
> > On 2013-03-19 18:42, Larry Martell wrote:
> >> https://docs.djangoproject.com/en/dev/howto/outputting-pdf/ which
> >> says to use the Content-disposition header to trigger the save as.
> >> I've done this, but I don't get a save as dialog box. The file is
> >> just downloaded to a download dir with the name I have provided.
> >>
> >> Is there a way I can specify from my app what directory I want the
> >> file saved to?
> >
> > I believe this is a browser-configuration setting controlled by the
> > user, not by HTTP metadata.  In Firefox, I have the option to either
> > open the file or save the file, along with a check-box to "always do
> > this"; FF also provides me the control to specify where the file
> > goes on a per-download basis, or to default to a given location.
> >
> > tl;dr: I don't think your web-app can take away this control from
> > the user.
> 
> That's what I thought, but my client wants the file saved to a
> specific location. This is an internal app, not something for public
> usage. Perhaps I can pass the file back in a context and save it from
> javscript.
> 

I'd be very surprised if you could use JavaScript to do something like
that. It would've been considered a security vulnerability by any
browser software vendor out there.

If client wants the file to be saved to specific location, you should
probably try to direct them to some specific solution for the browser
of their choice. For Firefox you should be able to find some extensions
that can automatically save files to certain directories based on file
type. Maybe there's something out there that could do so based on MIME
type (Content-Disposition) set for the file (so you can set something
other than PDF for it in order to have other website PDFs saved to
other locations).

If you are really persistent, you could try using some kind of Flash
thing or Java applet, but that's a very, very, very, very bad idea.

So, you'll probably left with negotiating it with your client not to
insist on that, or see if you can tweak the browser settings in some
way (most probably with an extension) :)

Best regards

-- 
Branko Majic
Jabber: bra...@majic.rs
Please use only Free formats when sending attachments to me.

Бранко Мајић
Џабер: bra...@majic.rs
Молим вас да додатке шаљете искључиво у слободним форматима.

Attachment: signature.asc
Description: PGP signature

Reply via email to