I'm looking into methods of how to create a file from a string, this could be plain text would save as .txt and php as .php etc but I was hoping to get some insight into it
**I found this code
$file = 'people.txt';
// Open the file to get existing content
$current = file_get_contents($file);
// Append a new person to the file
$current .= "John Smith\n";
// Write the contents back to the file
file_put_contents($file, $current);
But would I need to have people.txt saved on my server?
The force download part
header("Content-Disposition: attachment; filename=\"" . basename($File) . "\"");
header("Content-Type: application/force-download");
header("Content-Length: " . filesize($File));
header("Connection: close");
Where would I need to house the above, I'm assuming the code is right to force download my ready made file?