| | |
Save a webpage?
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
I would like to make a button that will save the current webpage you are viewing like clicking FILE>SAVE AS in IE, FF, etc. Once clicked you can "precode" the default name of the file based on the variables used in the webpage. Also I if possible I would like to omit certain details on the current webpage from being saved when the save as button is clicked.
So anyone got any ideas on how to make a save as button?
Thanks, Regards X
So anyone got any ideas on how to make a save as button?
Thanks, Regards X
"You never stop learning." - OmniX
PS: Even possible to change the default name of IE, FF, etc save as button to your variables on the php page.
"You never stop learning." - OmniX
Just send a file that represents the page, to the browser.
Some examples can be found here:
http://php.net/manual/en/function.readfile.php
Basically, you're sending the same file, but telling the browser to treat it as a download.
eg:
If the file is example.php
Then in that file, you could have a parameter $_GET['download'].
If it is set to TRUE, then let the browser know that the file is a download.
eg:
To enable that file to be downloaded, put:
Then you just need a add a link on that page:
Some examples can be found here:
http://php.net/manual/en/function.readfile.php
Basically, you're sending the same file, but telling the browser to treat it as a download.
eg:
If the file is example.php
Then in that file, you could have a parameter $_GET['download'].
If it is set to TRUE, then let the browser know that the file is a download.
eg:
php Syntax (Toggle Plain Text)
<?php // sample HTML echo '<p>I am example.php</p>'; ?>
To enable that file to be downloaded, put:
php Syntax (Toggle Plain Text)
<?php if (isset($_GET['download']) && $_GET['download']) { // tell browser its a download header('Content-Disposition: attachment; filename="example.php"'); } // sample HTML echo '<p>I am example.php</p>'; ?>
Then you just need a add a link on that page:
PHP Syntax (Toggle Plain Text)
<a href="index.php?download=1">download</a>
Last edited by digital-ether; Jul 2nd, 2009 at 12:45 am.
www.fijiwebdesign.com - web design and development and fun
Cpanel Email - Let users Register email accounts on your website upon registration
Ajax Chat - Fully browser based chat!
Cpanel Email - Let users Register email accounts on your website upon registration
Ajax Chat - Fully browser based chat!
![]() |
Similar Threads
- Save webpage (JavaScript / DHTML / AJAX)
- "Save Target As.." isn't working in IE6 (Web Browsers)
- i have this on my XP desktop:TROJAN-SPY.HTML.SMITFRAUD.c (Viruses, Spyware and other Nasties)
- Hacktool.rootkit problem! (Viruses, Spyware and other Nasties)
- Trojan-Spy.HTML.Smitfraud.c (Viruses, Spyware and other Nasties)
- Virus report: msdirectx.sys (Viruses, Spyware and other Nasties)
- Trying to get rid of Hacktool.rootkit (Viruses, Spyware and other Nasties)
- svchos1at.exe // svchoms1at.exe (Viruses, Spyware and other Nasties)
- HighJackThis File Log, Please Help! (Viruses, Spyware and other Nasties)
- I need help with my hi-jack log I dont know what fix (or delete) and what not. (Viruses, Spyware and other Nasties)
Other Threads in the PHP Forum
- Previous Thread: help with php redirect
- Next Thread: Passsword Strength Checker
| Thread Tools | Search this Thread |
ajax apache api array arrays beginner binary broken cache cakephp checkbox class cms code confirm cron curl customizableitems database date display dynamic echo email error external file files folder form forms forum function functions google header headmethod howtowriteathesis href htaccess html iframe image include insert integration ip java javascript joomla limit link login loop mail malfunction menu method mlm multiple mysql neutrality oop paypal pdf php phpmysql play problem query question radio random recursion regex remote root script search select server sessions sms soap source space sql syntax system table tutorial update upload url validator variable video web xml youtube






