Browse Source
Add ftp_append to create a new file or append data to an existing file (RFC959)
pull/2686/head
Add ftp_append to create a new file or append data to an existing file (RFC959)
pull/2686/head
committed by
Nikita Popov
8 changed files with 177 additions and 1 deletions
-
3NEWS
-
3UPGRADING
-
68ext/ftp/ftp.c
-
5ext/ftp/ftp.h
-
43ext/ftp/php_ftp.c
-
1ext/ftp/php_ftp.h
-
32ext/ftp/tests/ftp_append.phpt
-
23ext/ftp/tests/server.inc
@ -0,0 +1,32 @@ |
|||
--TEST-- |
|||
ftp_append() create new file and append something |
|||
--SKIPIF-- |
|||
<?php |
|||
require 'skipif.inc'; |
|||
?> |
|||
--FILE-- |
|||
<?php |
|||
require 'server.inc'; |
|||
|
|||
$ftp = ftp_connect('127.0.0.1', $port); |
|||
if (!$ftp) die("Couldn't connect to the server"); |
|||
|
|||
var_dump(ftp_login($ftp, 'user', 'pass')); |
|||
|
|||
@unlink(__DIR__.'/ftp_append_foobar'); |
|||
|
|||
file_put_contents(__DIR__.'/ftp_append_foo', 'foo'); |
|||
var_dump(ftp_append($ftp, 'ftp_append_foobar', __DIR__.'/ftp_append_foo', FTP_BINARY)); |
|||
|
|||
file_put_contents(__DIR__.'/ftp_append_bar', 'bar'); |
|||
var_dump(ftp_append($ftp, 'ftp_append_foobar', __DIR__.'/ftp_append_bar', FTP_BINARY)); |
|||
|
|||
var_dump(file_get_contents(__DIR__.'/ftp_append_foobar')); |
|||
|
|||
ftp_close($ftp); |
|||
?> |
|||
--EXPECTF-- |
|||
bool(true) |
|||
bool(true) |
|||
bool(true) |
|||
string(6) "foobar" |
|||
Write
Preview
Loading…
Cancel
Save
Reference in new issue