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

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
inosent1
Forum Commoner
Posts: 97
Joined: Wed Jan 28, 2009 12:18 pm

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

Post 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
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

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

Post 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\"");
inosent1
Forum Commoner
Posts: 97
Joined: Wed Jan 28, 2009 12:18 pm

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

Post 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 ...

User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

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

Post by requinix »

As with all calls to header() you have to do it before you've outputted anything.
Post Reply