reading files in a dir from windows machine.. php running on linux

hi experts,

i want to know is it possible for a php script which is running on linux, to read files in a directory which resides in windows platform?

i have a php program/script running on a linux server. most of the users here are using windows platform.

wut this program do is pretty simple. get the directory path from the user where inside the directory exists like a hundred text files. the program will read all the files in the directory, perform some tasks and put the output into a folder.

so how do I:
a) read the files in the directory specified by the user which is using windows platform on their local machine.
b) is it possible for php to read files from the client side?

would appreciate it if could give/suggest other way/method of doing this.

thank you.
LVL 1
cywingsAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

nicholassolutionsCommented:
>>b) is it possible for php to read files from the client side?
No. Because PHP is serverside, it is not possible to look through folders on the client's computer. If this were possible, it would be an enormous security risk. I would suggest you have your users make a zip file containing all the text files, and upload that to your server. Then you can unzip the files on your server like this:
http://www.clixnetwork.com/articles/32/php-unzip-file
http://www.1phpstreet.com/vb/scripts/ShowCode.asp?txtCodeId=1135&lngWId=8

for uploading examples, look here: http://www.php.net/features.file-upload

Then you can process each file, and generate an output file for the user to download. For example, if your output is text, and it is in the string $output, you could do:

$fname = 'output.txt';

header('Content-type: text/plain');
header('Content-Disposition: attachment; filename="' .$fname.'"');
echo $output;

which will force the browser to pop up a download window so the client can save the output on their computer. Note that if you use the header function like this, you have to call it before you send ANY other text to the browser.

Hope that helps.
Matt

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
BarthaxCommented:
If you are considering a PHP command-line and not a server-side web page, then the Linux machine will need to mount (smbmount) the files of the Windows machine through a Windows share.  Obviously this will need an installation of Samba on the Linux machine to perform the mount operation.  Once the Windows share is mounted then your script can parse the directory through the mount point as per any other mounted partition/mapping.
cywingsAuthor Commented:
hmmm nicholassolutions--> will try it out, give me some time...

users require minimum command-line and more on GUI thingy..it's betta if users can just click around to get the program working as desired.

thanx
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
PHP

From novice to tech pro — start learning today.