Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个网页,我想允许用户将内容保存到他的机器上。该网页已经在使用 AJAX 和prototype.js。服务器端代码是用 PHP 编写的。如何创建文件对话框以便用户也可以指定文件来保存数据?服务器正在运行 Linux。
HTML:
<input type="file" name="file" id="file">
PHP:
header('Content-type: text/plain'); header('Content-disposition:attachment; filename="yourfile.txt"');