NYCPHP Meetup

NYPHP.org

[nycphp-talk] PHP on Win.: Get Drive Letter for Current Script

Tim Gales tgales at tgaconnect.com
Sat Mar 12 11:13:28 EST 2005


Jayesh Sheth writes:

> I am trying to get PHP to co-operate when it comes to 
> creating a CD- / flash-drive-based catalog.
> 
> When a user pops in a CD or USB drive, the running PHP script 
> should be able to detect which drive letter it's on. 

> I also found a good article on the subject at PHP Architect ( 
> https://www.phparch.com/issue.php?mid=5 ).
> 
> This article lists the following code snippet to get and 
> display information using the GetSystemInfo function from 
> kernel32.dll. I looked at Microsoft's API documentation on 
> this subject ( 
> http://msdn.microsoft.com/library/en-us/sysinfo/base/getsystem
> info.asp?frame=true
> ) but I could not find out how to use this function to 
> determine the drive letter on which the current script is running.


GetCurrentDirectory( sizeof( DirPath ), DirPath );  
should give you the active drive and directory. 

I don't know if you can hook up to the call with 
 w32api_invoke_function (....) 

Seems like it might possibly work...

T. Gales & Associates
'Helping People Connect with Technology'

http://www.tgaconnect.com


 





More information about the talk mailing list