Detecting USB Device

  • Thread starter Thread starter Wee
  • Start date Start date

Wee

Wee

Associate
Joined
25 Apr 2006
Posts
130
Location
Scotland
Currently working on a little PHP project, and need someway of detecting when a USB device is attached to the users machine.

Is there anyway in achieving this? I understand that it's possible with Java, but I have zero experience with it.
 
I highly doubt this is possible with PHP because PHP is executed on the server and not the end users machine. I did something with them for my Diss last year so i have C# code to monitor and detect US devices if you wish to program in a proper language
 
Unless your interacting with a USB device on the server where PHP is running then it's not possible. EG: you could allow PHP to interact with a USB device through Apache on a server but as PHP is a server side scripting language you can't interact with a clients computers, as far as the clients are concerned they are just viewing a HTML page.

It is possible with Java (Sony use a java applet to install stuff onto PSP's connected via USB). What exactly are you tring to do?
 
My mistake. My wording wasn't to great. Something like this can't be done in PHP, was just giving a little background into what I was doing. Really appreciate the offer for the code, but I'm definetily going to be doing the entire project in PHP.

I'm looking to see when a client has a USB device attatched, and scan the files in the USB device to see if any MP3's are there ... then display a local link to the files.
 
Last edited:
That won't be possible with PHP unfortunatly, you would have to use client side code. Is there a reason for the use of PHP for this project?

If you are familiar with PHP 5's object oriented features and have written classes then you would probably pick up Java very easily as PHP borrows a lot of conepts from Java. To do what you explained, PHP is not a suitable language as it is a server side scripting language and not client-side like Java, Javascript (not related to Java at all), ActiveX etc.
 
Cheers for the replies guys, much appreciated.

The only reason it's in PHP is because it's the language I'm most comfortable with. Don't really have the time to sit down and learn a new language for the project. Which is why I assumed using a Java Applet was the only way around getting it to work.
 
You can't use a java applet that runs on a web page it needs to be a full java application. Web applets for sandboxed for secruity reasons and you will not have access to the system from it
 
Ah, so without ditching PHP and moving the project over to Java or .NET ... there isn't anyway of achieving this?

Cheers for all the help guys. Much appreciated.
 
Back
Top Bottom