PHP: Vérifier si Le fichier est accessible en écriture

<html>
<head>
<title>Is the file writable: is_writable()</title>
</head>
<body>
<?php
$file = "test.txt";
outputFileTestInfo( $file );
function outputFileTestInfo( $f ){
   if ( ! file_exists( $f ) ){
       print "$f does not exist<BR>";
      return;
   }
   print "$f is ".(is_writable( $f )?"":"not ")."writable<br>";
}
?>
</body>
</html>
           
       
<html>
<head>
<title>Is the file writable: is_writable()</title>
</head>
<body>
<?php
$file = "test.txt";
outputFileTestInfo( $file );
function outputFileTestInfo( $f ){
   if ( ! file_exists( $f ) ){
       print "$f n'existe pas<BR>";
      return;
   }
   print "$f ".(is_writable( $f )?"est ":"n'est ")." inscriptible<br>";
}
?>
</body>
</html>
 
           
       

No Comments

  • Your comment is awaiting moderation

    Lines of silver intricately weave out and in to
    form the form of the ring with the petals of the flower in the centre.

    Look at my web-site … Joma Jewellery Sale (http://www.czczcz.net/)

Join the Discussion

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>