By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
428,530 Members | 880 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 428,530 IT Pros & Developers. It's quick & easy.

Read data from USB using PHP

AMT India
P: 64
I have a device connected at my USB drive. There is an html form, that contains a tables with lots of rows and columns. I want to populate this table by using a php program, that reads the data from the USB port. How can I do this?
May 30 '07 #1
Share this Question
Share on Google+
3 Replies


pbmods
Expert 5K+
P: 5,821
If the data is contained in a file, you can just use file_get_contents to read the file. You just would have to know where the USB drive got mapped.
May 30 '07 #2

P: 4
You Can't Do This You
May 31 '07 #3

pbmods
Expert 5K+
P: 5,821
Perhaps I misunderstood. Are you talking about the User inserting a USB stick into a machine and then accessing a website which is being served from a different computer?

In this case, the best you can do is guess where the file is stored and redirect the User's browser to that file, but since your PHP script is server-side, all you can do is guess. You'd be better off serving the site directly from a USB drive, then making occasional AJAX calls to the main server to update the database.

This is just as well. Can you imagine the chaos that would ensue if web scripts could grab files off of clients' hard drives at will?
May 31 '07 #4

Post your reply

Sign in to post your reply or Sign up for a free account.