I have a webpage that I want to allow the user to save the contents to his machine. The webpage is already using AJAX with prototype.js. The server side code is written in PHP. How can I create a File Dialog so the user can specify the file to save the data too? The server is running Linux.
HTML:
<input type="file" name="file" id="file">
PHP:
header('Content-type: text/plain');
header('Content-disposition:attachment; filename="yourfile.txt"');