Reputation: 45
I would like to ask, whether is it possible for PHP to check the plugged in USB drive and show the windows drive that it use, and parse it into the form?
If it possible, how do i do it?
Upvotes: 1
Views: 930
Reputation: 697
If you are looking for a file on the USB device you could try somthing like:
$AtoZ = "abcdefghijklmnopqrstuvwxyz";
$USBDRIVE = "";
for ($i=0; $i < 27; $i++) {
$filename = $AtoZ[$i].':/usb.txt';
if (file_exists($filename)) {
$USBDRIVE = $AtoZ . ":/";
}
}
Upvotes: 1
Reputation: 103
use a php system() or exec() function to call out to a windows batch command. The batch command would have to find the USB drive. Perhaps you could list all drives, and use the drive 'label' to identify which line contained the drive letter you were interested in, eg D:> '4GB FLASH DRIVE'
Upvotes: 2