Edit report at https://bugs.php.net/bug.php?id=40574&edit=1
ID: 40574 Comment by: simonsimcity at gmail dot com Reported by: [email protected] Summary: file_put_contents fails with ftp wrapper Status: No Feedback Type: Bug Package: Streams related PHP Version: 5.2.1 Block user comment: N Private report: N New Comment: Please ignore/delete my last comment. I was not seriously checking the script I run. The PEAR-library seem to have an error here because I do not get an error on using fopen, frwite and fclose, but the file is not written. Previous Comments: ------------------------------------------------------------------------ [2012-01-10 15:17:09] simonsimcity at gmail dot com I think I have the same issue reproduced in a slightly different way: In one script I tried to upload a file using WebDAV. Therefore I used the PHP-Library HTTP_WebDAV_Client_Stream. This library registers the streams webdav:// and webdavs:// When I try to save into that stream using file_put_contents() it fails returning "Only 0 of 160 bytes written, possibly out of free disk space" .. but the work-arround (using fopen, fwrite and fclose) works. Here's the code: http://pastebin.com/8tDqyg4K ------------------------------------------------------------------------ [2007-05-30 00:49:33] lc at nospam dot com I am also getting the same behavior mat describes using 5.2.2 The only way to get a successfull upload using file_put_contents using a ftp stream is when the file being uploaded does not exist on the server. Subsequent uploads with the stream_context of overwrite being true result in a zero-byte file ------------------------------------------------------------------------ [2007-03-28 14:34:44] mat at actiondb dot com The example: <?php $c = stream_context_create(array("ftp" => array("overwrite"=>true))); var_dump(file_put_contents("ftp://localhost/upload/data.txt", "data", 0, $c)); ?> Will output int(4), but if you check the FTP server, the file will probably be 0 bytes. I have been trying to resolve this problem myself, and it seems that if the file is greater than around 30K-35K (maybe it's 32K?), the upload works. I'm using PHP 5.2.1 on Apache 2.2.4 installed on Win2k3 ------------------------------------------------------------------------ [2007-03-14 01:00:00] php-bugs at lists dot php dot net No feedback was provided for this bug for over a week, so it is being suspended automatically. If you are able to provide the information that was originally requested, please do so and change the status of the bug back to "Open". ------------------------------------------------------------------------ [2007-03-06 11:55:08] [email protected] Can't reproduce using vsftpd. ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at https://bugs.php.net/bug.php?id=40574 -- Edit this bug report at https://bugs.php.net/bug.php?id=40574&edit=1
