★ wanayoo — archive 1999 http://www.php.net/manual/de/function.is-writeable.phpNouvelle recherche | Portail wanayoo

PHP Home Page

Manual Table of Contents
Up to Filesystem
Quick Reference
English version of this pageJapanese version of this pageItalian version of this pageFrench version of this pageHungarian version of this page
Filesystem
* basename
* chgrp
* chmod
* chown
* clearstatcache
* copy
* delete
* dirname
* diskfreespace
* fclose
* feof
* fgetc
* fgetcsv
* fgets
* fgetss
* file
* file_exists
* fileatime
* filectime
* filegroup
* fileinode
* filemtime
* fileowner
* fileperms
* filesize
* filetype
* flock
* fopen
* fpassthru
* fputs
* fread
* fseek
* ftell
* fwrite
* set_file_buffer
* is_dir
* is_executable
* is_file
* is_link
* is_readable
* is_writeable
* link
* linkinfo
* mkdir
* pclose
* popen
* readfile
* readlink
* rename
* rewind
* rmdir
* stat
* lstat
* realpath
* symlink
* tempnam
* touch
* umask
* unlink
Manual: is_writeable
View the source code for this pageSearch the site



Previous page
 is_readable
 Updated
Sat, 12 Aug 2000
link 
Next page


is_writeable

(PHP3 , PHP4 )

is_writeable --  Ermittelt, ob in eine Datei geschrieben werden kann

Beschreibung

bool is_writeable (string filename)

Gibt TRUE zurück, wenn die Datei existiert und nicht schreibgeschützt ist. Das Dateinamen-Argument kann ein Verzeichnisname sein. So können Sie überprüfen, ob in ein Verzeichnis geschrieben werden kann.

Bedenken Sie, dass PHP mit der Benutzer ID auf die Datei zugreift, unter der der Webserver läuft (oftmals ist dieses 'nobody'). Beschränkungen durch safe_mode werden nicht berücksichtigt.

Das Ergebnis dieses Funktionsaufrufes wird zwischengespeichert. Siehe auch clearstatcache() für weitere Einzelheiten.

Siehe auch is_readable().


User Contributed Notes: is_writeable


brandy@klammeraffe.org
07-Jul-1999 08:48
<PRE>
&lt;?php
/*
\\
\\ -mat- filid brandy, brandy@ecrc.de, Cable&Wireless ECRC GmbH
\\ Wed Jul 7 14:47:43 CEST 1999
\\
\\ my_is_writeable.inc
\\ checks whether a file is writeable or not. PHP3 function is_writeable() is broken.
\\
*/

Function my_is_writeable( $filename ) {

clearstatcache();

$perms = @Fileperms( $filename );
$owner = @FileOwner( $filename );
eregi( "^uid=([0-9]*)", exec( "id"), $regs );
$apacheuid = $regs[1];

/* Hint: integers starting with '0' are octal */
$perms = 0777 & $perms;

if ( $apacheuid != $owner ) {
if ( 06 == ( 07 & $perms ) ) { return 1; } else { return 0; }
} else {
if ( 0600 == ( 0700 & $perms ) ) { return 1; } else { return 0; }
}
}
?>
</PRE>



hellekin@imaginet.fr
27-Oct-1999 09:07
It seems that is_writeable() became <b>is_writable()</b> in 4.0b2.


zeekamotay@hotmail.com
13-Feb-2000 11:38
My my_is_writeable() is shorter than yours is! :)

Using include_path:

function my_is_writeable ($file) {
return(@fclose(@fopen($file,"a",1)));
}

Not using include_path:

function my_is_writeable ($file) {
return(@fclose(@fopen($file,"a")));
}



laroche@nobug.lu
21-Mar-2000 05:39
Why can't I verify if a file like www.nobug.lu/index.php3 is readable, or writeable ? Because I wanna check is a file exists or not an with file_exists it don't work too, ... Well would be fine when someone could explain me this problem.


hellekin@imaginet.fr
21-Jul-2000 01:43
is_writeable() works in PHP 4.0.1pl2 (didn't check for earlier versions).


 About Notes


Previous page
 is_readable
 Updated
Sat, 12 Aug 2000
link 
Next page





Who's responsible for this?
Top of this page

Site
Hosting:



Located in
United States
Elements of this website are subject to copyright.
Questions about installing or using PHP should be directed to one of the mailing lists.
Only questions about the website should be directed to webmaster@php.net.