Page 1 of 1
Can JavaScript create a file ?
Posted: Sat Sep 25, 2004 6:46 am
by Calimero
The Idea:
I need JavaScript to create a blank file, and then populates it with some data on the clients computer - is this possible (automatically, or with prompting window of some kind - for user to allow this file creation),
and if there is can it of any extension.
Else ( Can, after php creates the file, javascript deploy that file ).
Any ideas and code snippets or reference referencing are welcome, thanks !
Posted: Sat Sep 25, 2004 9:42 am
by John Cartwright
Not on the users computer...
Posted: Sat Sep 25, 2004 10:44 am
by feyd
simple answer: no to both. Javascript has zero access to the user's computer.
...
Posted: Mon Sep 27, 2004 2:30 am
by Calimero
Ok, but my idea is based on the following:
Javascript can execute some file, can it pass some argument for that file to be executed (like copy / paste to clipboard),
so I run notepad, and insert data, and save the file - .... to desired location or to internet temporary files ...
The other way I planned is to prompt - or tell my users to create / save the file, anywhere on the hard-disk and when they log in again, my site (I don't know how

should automatically call the contents of that file - for personalisation purpose.
Is this possible - in theory, I'm solving that problem now, the code is not neccecary - I have to do something on my own, right

.
Tnks Ahd !
Posted: Mon Sep 27, 2004 2:39 am
by feyd
why do you keep insisting on storing this data on their machine? We've told you many times now, use a database to store the information.
It's not possible for Javascript to access any file in the filesystem. Javascript can only access the content available through the page(s) it sits on or around.
Your server cannot pull a file from a remote location without that remote location (someone's computer) being either directly networked to the server or the remote location being a server in itself.
...
Posted: Mon Sep 27, 2004 2:55 am
by Calimero
ok, ok,
just, I'm new to JavaScript,
I,m reading about it and trying to get the limits of the JavaScript and practical use of it.