| | |
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 |
apache api array beginner beneath binary broadband broken button cakephp checkbox class cms code countingeverycharactersfromastring crack cron curl database date display dynamic echo email error fcc file files folder form forms freelancing function functions google href htaccess html image include incode insert integration ip javascript joomla limit link login mail match menu method mlm mod_rewrite multiple mysql oop pageing pagerank paypal pdf php problem query radio random recursion recursiveloop remote script search server sessions sms smtp soap source space sql strip_tags subversion support! survey syntax system table template tutorial undefined update upload url validator variable video virus web window.onbeforeunload=closeme; youtube






