Say I stick an array of things into a variable....(for DLing a Diary).....how would i write that variable in, oh say, "diary.txt"....
furthermore, how would i have it automatically delete the file after they are done using it?
THANKS!
How might I write a variable to a file?
Moderator: General Moderators
Dling a diary? can you explain?
of course you can stick the contents of an array in a textfile and retrieve them later.
For instance I ususally create:
$include = "the array's contents";
then write that in.
but errrr can you explain in more detail? do you want to create a diary script? Or news thing? That's not too hard. I have one at the alienhelpdesk. (called the articler) is that what you need?
of course you can stick the contents of an array in a textfile and retrieve them later.
For instance I ususally create:
$include = "the array's contents";
then write that in.
but errrr can you explain in more detail? do you want to create a diary script? Or news thing? That's not too hard. I have one at the alienhelpdesk. (called the articler) is that what you need?
why do you want to write the data to a file and then let the user download it? Why not simply write the contents as plain text? The user may save the file from within the browser.
If you want to emphazise "hey, a file is comming - save it" you may use header informations like
header("Content-Disposition: attachment; filename=diary.txt");
You may also (or as addition) use the gzip functions since (I think) all browsers offer "save file" for application/x-gzip
If you want to emphazise "hey, a file is comming - save it" you may use header informations like
header("Content-Disposition: attachment; filename=diary.txt");
You may also (or as addition) use the gzip functions since (I think) all browsers offer "save file" for application/x-gzip