Selecting a file on the client side?

Hi there,
is there a generic way to allow the client to access the file system on their pc and select a file on both windows and unix clients machines. The end purpose of this is to upload the file to the webserver. I suppose I am looking for an Open file type Window for both platforms.

Any suggestions would be great.
Williery



williery10Asked:
Who is Participating?
 
spencerslamConnect With a Mentor Commented:
The code to prompt the user for the file is fairly simple:

<form action="myupload.php" method=post enctype="multipart/form-data">
submit this file: <input type=file name="userfile"><br>
<input type=submit><br>
</form>

Then to process it:

if(!empty($userfile)) {

copy($userfile, "/php/www/files/myfile.txt");

unlink($userfile);

echo("file uploaded");
}


Hope that helps.
0
 
s-maximCommented:

So, basically you want to be a user that visit my webpage that grabs a file I want from his system and sends it to me without user's intervention?

This (thanks god) is impossible. You can maybe write a Java or C program that user downloads and then interact with it some other way.

Short answer - no, you can't read/select/upload client's files unless they chose to.

Maxim Maletsky
maxim@php.net
0
 
spencerslamCommented:
The code to prompt the user for the file is fairly simple:

<form action="myupload.php" method=post enctype="multipart/form-data">
submit this file: <input type=file name="userfile"><br>
<input type=submit><br>
</form>

Then to process it:

if(!empty($userfile)) {

copy($userfile, "/php/www/files/myfile.txt");

unlink($userfile);

echo("file uploaded");
}


Hope that helps.
0
 
carchitectCommented:
spencerslam is right
regards
0
 
williery10Author Commented:
thats great,
cheers
0
All Courses

From novice to tech pro — start learning today.