I use this to put contents in a file
file_put_contents('abc.txt', $text);
I need to open a popup for the user to save / load the file as I would do
This will give the user a download request:
<?php header('Content-type: text/plain'); // What file will be named after downloading header('Content-Disposition: attachment; filename="abc.txt"'); // File to download readfile('abc.txt'); ?>
The manual fpassthru()provides a complete example.
fpassthru()
Use the Content-Disposition header:
header('Content-Disposition: attachment; filename="abc.txt"'); readfile('abc.txt');
Be sure to send the appropriate Content-Type header.
You must pass the correct headers:
header("Content-disposition: Atachment");
Source: https://habr.com/ru/post/1773949/More articles:Why does mechanization list one form? - pythonIs it possible to perform "mixed" serialization of XML in .net? - xmlIs there a python unit test framework that gives a compact error output when comparing strings - pythonXmlSerializer and OnSerializing / OnSerialized alternatives - c #How to create a data model for an access control list (ACL) - sqlWebsite Administration Tool. Type not allowed for member 'StructureMap.StructureMapException' - asp.netIs there a linux command to lock until a process exits? - linuxHow can I register a generic class as IHttpModule - asp.netPython recursive loop function - pythonHow to request index metadata in PostgreSQL - postgresqlAll Articles