Page 1 of 1

Read Text File From Client Machine

Posted: Wed Sep 25, 2013 5:25 am
by avrgod
Hi Developers,

I want my hardware to interact with web.
So for that i have a desktop application at client machine which will generate a text file after getting data from hardware.

Now i want that text file to be read by server and get its data so that i can manipulate data on server and make it accessible from anywhere.

I am not much into PHP but i can make it work with some HELP, Suggestion or Example.

So Please give your ideas for the same. :)

Thanks in advance!!!

Re: Read Text File From Client Machine

Posted: Wed Sep 25, 2013 5:42 am
by Celauran
You'll need to have the user attach the file to a form. You cannot read files on a user's machine for fairly obvious security reasons.

Re: Read Text File From Client Machine

Posted: Wed Sep 25, 2013 5:46 am
by avrgod
Thanks Celauran :) for your quick reply.

But i need to do it without any user. Can u suggest any other method or something to achieve it without user attach the file to a form??

Re: Read Text File From Client Machine

Posted: Wed Sep 25, 2013 6:25 am
by Celauran
As I mentioned already, you can't. I don't mean shouldn't, I mean can't.

Re: Read Text File From Client Machine

Posted: Wed Sep 25, 2013 9:48 am
by AbraCadaver
Have the client machine either copy the file to a share on the server or some other intermediate share that is accessible to both the client and server. Maybe have this copy done after the desktop app creates the text file.

Re: Read Text File From Client Machine

Posted: Thu Sep 26, 2013 2:38 am
by avrgod
Thanks AbraCadaver :)

I got your point.
Can you suggest how to share that text for both client and server?

I mean how to achieve that? (After reading you reply i googled it but nothing much i got)

Re: Read Text File From Client Machine

Posted: Sat Mar 29, 2014 6:13 am
by ArunSM
One of the way to achieve it is to store your generated file on some File Server / DB Server (Anyhow this can again only be written in Client Application) if you need automation.

Workaround if you cannot modify your application: You can write a watch script which will be monitoring your generated file. Upon any change trigger a request which sends your file to some safe location (again it needs to be server). If you feel data update happens too often then setup CRON command to do this job after regular interval.

Again there may be ways to do it. These are few easy ways though.

Re: Read Text File From Client Machine

Posted: Sat Mar 29, 2014 12:15 pm
by Christopher
avrgod wrote:Hi Developers,

I want my hardware to interact with web.
So for that i have a desktop application at client machine which will generate a text file after getting data from hardware.

Now i want that text file to be read by server and get its data so that i can manipulate data on server and make it accessible from anywhere.
I think the first question is whether this is a push or pull architecture. Given what you have described, I think it makes the most sense for the desktop application to push the data to the web server. To do that you just need to implement a web service on the web server. Then the applications can push data whenever they need to. The central web server can the process that data and make it available as needed. Use SOAP or similar for you web service. I would recommend using a HTTPS connection as well. Also, the web server can return data to the desktop application in the response if needed.