Check if the specified file is writeable with is_writable() function in PHP

Description

The following code shows how to check if the specified file is writeable with is_writable() function.

Example


  /* w  w w  . j av a  2 s  . co  m*/
<?php
    $file = "test.txt";
    if(is_writable($file)){
      echo ("$file is writeable");
    }else{
      echo ("$file is not writeable");
    }
?>

The code above generates the following result.





















Home »
  PHP Tutorial »
    File »




Directory
DirectoryIterator
Drive
File
File Permission
File Read Save
FileSystemIterator
Path
Zip