Save HTML file locally

Working on a template system where it creates HTML templates, I have it saving to my ftp by using the following code


$fp = fopen($_POST['savedoc'], 'w');
 fwrite($fp, $view);
 fclose($fp);

Code used for typing in the location I want it saved (only seems to work when saving remotely).


<p>Save DIR: <input name="savedoc" type="text" /></p>

This saves fine, however I wanted to know if there was a way of saving locally to a computer and selecting the location myself has it will change from time to time. (A bit like when you click on a browse button when uploading a file/attachment)

You want to select where to save on the machine that is browsing the page? Not possible I’m afraid.

Or, are you wanting to invoke the standard download prompt?

The download prompt will work fine for what I need. :wink:

In which case, the manual has an example for you. :slight_smile:

That works a treat but on the downloaded version it has the following at the top of the page

<br />
<b>Warning</b>:  readfile(original.html) [<a href='function.readfile'>function.readfile</a>]: failed to open stream: No such file or directory in <b>/home/content/93/7766993/html/templateobject/index.php</b> on line <b>22</b><br />

Agh just removed this


// The PDF source is in original.pdf	
readfile('original.html');

and seems to be working a treat now :slight_smile: Thank you once again!