Save page to file
Moderator: General Moderators
Save page to file
I need help with the following task.
Basically, what I want to do is to be able to write a whole php page to a file. Not the html tags etc., just the content.
This page could potentially be several hundred lines long.
My initial thoughts was to save the whole page into a variable and write the variable, but I can't really see how to do it.
Any help appreciated.
Basically, what I want to do is to be able to write a whole php page to a file. Not the html tags etc., just the content.
This page could potentially be several hundred lines long.
My initial thoughts was to save the whole page into a variable and write the variable, but I can't really see how to do it.
Any help appreciated.
Okay I have this working, but is there a way for the user to specify a filename and a location for the file to be saved?
I found this javascript code snippet that launches a 'save as' dialogue box, which seems to be a much more elegant solution. The only problem is is doesn't work on Firefox under Windows or Linux.
Is there an equivalent piece of code in PHP?
Or does anyone know a fix for the above piece of javascript. (I know this isn't really the place to ask, but one of you web developers may have come across this problem.)
Thanks for any help
I found this javascript code snippet that launches a 'save as' dialogue box, which seems to be a much more elegant solution. The only problem is is doesn't work on Firefox under Windows or Linux.
Code: Select all
onclick="javascript: document.execCommand('SaveAs','1','Filename');"Or does anyone know a fix for the above piece of javascript. (I know this isn't really the place to ask, but one of you web developers may have come across this problem.)
Thanks for any help
-
d3ad1ysp0rk
- Forum Donator
- Posts: 1661
- Joined: Mon Oct 20, 2003 8:31 pm
- Location: Maine, USA
Control+Sscs3rd wrote:Okay I have this working, but is there a way for the user to specify a filename and a location for the file to be saved?
I found this javascript code snippet that launches a 'save as' dialogue box, which seems to be a much more elegant solution. The only problem is is doesn't work on Firefox under Windows or Linux.
Is there an equivalent piece of code in PHP?Code: Select all
onclick="javascript: document.execCommand('SaveAs','1','Filename');"
Or does anyone know a fix for the above piece of javascript. (I know this isn't really the place to ask, but one of you web developers may have come across this problem.)
Thanks for any help