Possible Duplicate:
How do you check for permissions to write to a directory or file?
I'm trying to figure out if it is possible to determine if a requested file directory is writable and the current user have the right permissions to write into that folder.
Till now I'm making a test for the requested path by creating new directory, writing a temp file into it and remove it (the temp file and directory).
This operation is very problematic since that directory may be exist already and all of its old information can be lost (when the directory remove).
Any idea ?? Tx...
The best approach is to attempt the operation and let the system decide whether or not it is allowed. Duplicating the checks that the system performs would be terribly hard to get right. Just let the system decide, it is the ultimate arbiter.