By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,401 Members | 1,381 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,401 IT Pros & Developers. It's quick & easy.

PHP and Javascript

P: n/a
Hello all,

I know this more a javascript rather than a php problem,
but i searched internet and couldn't find an answer.

Here it is : I simply want to know how to open a "Open File"
or "Save File" box, after clicking an html button.

I'm sure it's a three-lines-of-code problem :)
Which class implements this ?

Thank you very much

Ismael
Jul 20 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
In article <c5**************************@posting.google.com >,
is****@club-internet.fr says...
Hello all,

I know this more a javascript rather than a php problem,
but i searched internet and couldn't find an answer.

Here it is : I simply want to know how to open a "Open File"
or "Save File" box, after clicking an html button.

I'm sure it's a three-lines-of-code problem :)
Which class implements this ?


<input type="file">

--
Hywel I do not eat quiche
http://kibo.org.uk/
http://kibo.org.uk/mfaq.php
Jul 20 '05 #2

P: n/a
Ismael wrote:
Hello all,

I know this more a javascript rather than a php problem,
but i searched internet and couldn't find an answer.

Here it is : I simply want to know how to open a "Open File"
or "Save File" box, after clicking an html button.

I'm sure it's a three-lines-of-code problem :)
Which class implements this ?


To upload a file (get the "Open file" dialog) you place a form on your
page with an <input type="file">.

To force the browser to show a "Save file" dialog rather than
displaying/opening the requested file you have to send an according
mime-type within the HTTP header. This you can do with PHP:

header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename="myfile.txt"');
Regards

--

brotherli

[ mails to nu**@brotherli.ch won't be read! replace nugs with endless. ]
Jul 20 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.