note 56162 added to function.ftp-put
| From: | ben at over dot bomb | Date: | Thu, 25 Aug 2005 12:28:58 +0000 |
| Subject: | note 56162 added to function.ftp-put | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-94180@lists.php.net to get a copy of this message | ||
I spent some time debugging a silly problem:
In php >= 5, ftp_put() will apparently rewind to the start of the file regardless of the state
you left it in before sending it to the $host.
I found this out because I wasn't closing the file handle before using ftp_put(). Since I had
just written to the file, the file pointer must have been located at the *bottom*.
I was sending a 0-byte file on php 4.2.2., but worked fine on php 5.
So, just a heads up, don't forget to close those filehandles. Even though I was using the
filename as the argument for ftp_put, it still needs to be closed.
I did not call rewind on the file handle, just fclose($file_h).
----
Manual Page -- http://www.php.net/manual/en/function.ftp-put.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+56162
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+56162&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+56162&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+56162&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+56162&report=yes&reason=useless
Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+56162&report=yes&reason=non-english
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+56162&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+56162&report=yes
Search -- http://master.php.net/manage/user-notes.php