?
Solved

Selecting a file on the client side?

Posted on 2003-02-22
5
Medium Priority
?
208 Views
Last Modified: 2011-08-18
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



0
Comment
Question by:williery10
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 1

Expert Comment

by:s-maxim
ID: 7999305

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
 

Expert Comment

by:spencerslam
ID: 7999338
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
 

Accepted Solution

by:
spencerslam earned 200 total points
ID: 7999741
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
 
LVL 6

Expert Comment

by:carchitect
ID: 8002040
spencerslam is right
regards
0
 

Author Comment

by:williery10
ID: 8015386
thats great,
cheers
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I imagine that there are some, like me, who require a way of getting currency exchange rates for implementation in web project from time to time, so I thought I would share a solution that I have developed for this purpose. It turns out that Yaho…
Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this. Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it i…
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
Suggested Courses

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question