Hi
i want to create a txt file in client computer using php or javascript. how to create??
how to create a txt file in client side using php or js
Moderator: General Moderators
-
selvamdoom
- Forum Newbie
- Posts: 7
- Joined: Wed Apr 29, 2009 12:53 pm
Re: how to create a txt file in client side using php or js
i'm not sure but as far as i can remember you can't do that.. BUT you can display the data into the client's browser which can be saved by the client as a text file.
Re: how to create a txt file in client side using php or js
Heads for PHP - Code, Tails for Javascript...
Tails!
Moved to Javascript
Tails!
Re: how to create a txt file in client side using php or js
You can create a file and pass it to user for download (can't set filename, at least I'm don't know how), but you can't create it on clients computer.
Code: Select all
function downloadTxtFile (str) {
document.location.href = 'data:application/data;charset="utf-8",' + str;
//Using incorrect mime type because text/plain will open it in browser instead of showing download
}