Title says it all, I tried disk_free_space(), but it is not working for me. I guess it only returns "disk space" and not just any random media.
I have a script that would create another file in the removable drive, and a simple check for free space would definitely be helpful.
You can try diskfreespace()
function. It returns the free space, in bytes, of the specified directory. This function is an alias of the disk_free_space() function.