View Single Post

  #4 (permalink)  
Old 05-07-2008
robinv@gmail.com
 
Posts: n/a
Default Re: [PHP] How to determine if file is writable and deletable

On 07/05/2008, Al <news@ridersite.org> wrote:
> I need to determine if a file is truly deletable by a php script, Deleting
> permissions seem to be
> the same as writing, they probably have the same criteria.


You're not writing to the file, you're unlinking it from the
containing directory, so it's the directory's permissions that matter,
not the file's.

All you really need to do is check that the directory is_writable()

is_writable(dirname($filename));

-robin
Reply With Quote