Page 1 of 1

use php to display Save As dialog and direct to right folder

Posted: Fri Mar 15, 2013 1:52 pm
by inosent1
i am trying to save a step. when files come in we need to upload to the remote host, and then save to a PC on the local network. As it is, this involves 2 distinct steps. What i was hoping for is once the user has located the file, they, upon submit will 1) store that file to the remote server (upload), and then 2) save it to the local PC.

to simplify this a little, is there a way to use the php code to pop up a save as dialog box, direct the user to the correct folder on the local PC, and have the file name showing in the Save As dialog box, where from that point all they have to do is click 'OK'

TIA

Re: use php to display Save As dialog and direct to right fo

Posted: Fri Mar 15, 2013 1:57 pm
by requinix
You cannot specify a folder - the most you can do is give the filename.

Code: Select all

header("Content-Disposition: attachment; filename=\"filename.ext\"");

Re: use php to display Save As dialog and direct to right fo

Posted: Fri Mar 15, 2013 2:21 pm
by inosent1
hi requinix

thanks for the reply

with this code

Code: Select all

<? header("Content-Disposition: attachment; filename=\"filename.ext\""); ?>

i get this error

Code: Select all

Warning: Cannot modify header information - headers already sent by (output started at ...


Re: use php to display Save As dialog and direct to right fo

Posted: Fri Mar 15, 2013 3:04 pm
by requinix
As with all calls to header() you have to do it before you've outputted anything.