Bug #52141 [Opn->Bgs]: little problem
| From: | wiesemann@php.net | Date: | Sun, 27 Jun 2010 20:00:11 +0000 |
| Subject: | Bug #52141 [Opn->Bgs]: little problem | ||
| References: | 1 | Groups: | php.doc.bugs |
| Request: | Send a blank email to doc-bugs+get-4607@lists.php.net to get a copy of this message | ||
Edit report at http://bugs.php.net/bug.php?id=52141&edit=1
ID: 52141
Updated by: wiesemann@php.net
Reported by: haheute at googlemail dot com
Summary: little problem
-Status: Open
+Status: Bogus
Type: Bug
-Package: Website problem
+Package: Documentation problem
Operating System: ubuntu
PHP Version: Irrelevant
-Assigned To:
+Assigned To: wiesemann
New Comment:
The example shows how to append ('a' mode in fopen() call) something to
a file. This requires that the file exists and that the file is
writable. I.e. the example assumes that test.txt has already been
created (=> this is outside of the scope of the example).
Previous Comments:
------------------------------------------------------------------------
[2010-06-22 12:05:52] haheute at googlemail dot com
Description:
------------
Beispiel #1 Ein einfaches Beispiel für fwrite:
does not work, because is_writeable is before fopen
i had to change to:
1. fopen and than:
2. is_writeable and
3. fwrite
otherwise an error occurs, saying file xy is not writeable
greetings.h.
Test script:
---------------
this works on my webspace (already changed from the php.net.example)
//--bildtexte-einschreiben
$filename = "upload_anonym/" . $name.".txt";
if (!$handle = fopen($filename, "w")){
print "Kann die Datei $filename nicht öffnen";
exit;
}
if (is_writable($filename)) {
if (!fwrite($handle, $bildtext)) {
print "Kann in die Datei $filename nicht schreiben";
exit;
}
print "<span style=\"background-color:#ad8;
font-size:0.9em;\">Bildtexte gespeichert in: ".$filename."</span>";
fclose($handle);
}else{
print "Die Datei $filename ist nicht beschreibbar.";
}
//--------------------------
Expected result:
----------------
text file containing a picture description
Actual result:
--------------
kk
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/bug.php?id=52141&edit=1