how to read a txt file from client's drive
Moderator: General Moderators
how to read a txt file from client's drive
HI all,
Does any know how to read a txt file from client's C: or A: drive, without the user knowing?
I m developing an application using PHP, and I m stuck when i try to read a special txt file (that i keep in their PC) from the user's PC. If I let the user browse the directory, I know i can use this, ...
<input type="file" class="Wf" name="userfile" size="24">
Any other way, if i dont wanna let the user to know that i m keep a special file in their PC?
Does any know how to read a txt file from client's C: or A: drive, without the user knowing?
I m developing an application using PHP, and I m stuck when i try to read a special txt file (that i keep in their PC) from the user's PC. If I let the user browse the directory, I know i can use this, ...
<input type="file" class="Wf" name="userfile" size="24">
Any other way, if i dont wanna let the user to know that i m keep a special file in their PC?
-
PieroRuffino
- Forum Newbie
- Posts: 3
- Joined: Wed Sep 01, 2004 2:59 am
Fopen()
Ciao from Italy,
perhaps but i'm a newby in PHP you should use :
$fp = fopen("c:\\data\\file.txt","r");
But I'm not completly sure because on my localhost it works, but in remote it doesn't ....
Anyone else can help us ????
Ciao Piero Ruffino
perhaps but i'm a newby in PHP you should use :
$fp = fopen("c:\\data\\file.txt","r");
But I'm not completly sure because on my localhost it works, but in remote it doesn't ....
Anyone else can help us ????
Ciao Piero Ruffino
-
PieroRuffino
- Forum Newbie
- Posts: 3
- Joined: Wed Sep 01, 2004 2:59 am
-
PieroRuffino
- Forum Newbie
- Posts: 3
- Joined: Wed Sep 01, 2004 2:59 am
The only remote data that a script can read and write is whatever is in cache (Temporary Internet Files for IE). That way you dont need the user to know as well. To upload other files located elsewhere you need to have <INPUT TYPE=file> element which HAS to be entered by the user. Cannot set value for that file textbox - at least not in IE.
- CoderGoblin
- DevNet Resident
- Posts: 1425
- Joined: Tue Mar 16, 2004 10:03 am
- Location: Aachen, Germany
Think about the design of your system. Can you explain why the file needs to be kept on the client machine. Why not store it on the server ?
Personally I see no reason to store a file on the client machine which they should not know about.
If you are storing information used by your system, designing your system to use a database and possibly Session/Cookies solves the problem and would also ensure the same user can access the same information from different machines. A win win situation rather the going through Certification processes.
Personally I see no reason to store a file on the client machine which they should not know about.
If you are storing information used by your system, designing your system to use a database and possibly Session/Cookies solves the problem and would also ensure the same user can access the same information from different machines. A win win situation rather the going through Certification processes.
There are 2 wild reasons that i m looking at.
1st, if i read the file from the user's A: drive. As usual, the user need to provide username and password to get access. I have another key which is generated by the system and tie to the user account. The key could be 512 characters long, or longer. I store the key in the diskette and pass to valid user. User can access from any PC as long as they have the username, password and key.
2nd, if i read the file from the user's C: drive. In order to access the system, the user PC must have this file. This very much like a certificate, user can only get access to the system from particular PC.
1st, if i read the file from the user's A: drive. As usual, the user need to provide username and password to get access. I have another key which is generated by the system and tie to the user account. The key could be 512 characters long, or longer. I store the key in the diskette and pass to valid user. User can access from any PC as long as they have the username, password and key.
2nd, if i read the file from the user's C: drive. In order to access the system, the user PC must have this file. This very much like a certificate, user can only get access to the system from particular PC.