xref: /PHP-7.2/ext/ftp/tests/ftp_append.phpt (revision 29e4d4ee)
1--TEST--
2ftp_append() create new file and append something
3--SKIPIF--
4<?php
5require 'skipif.inc';
6?>
7--FILE--
8<?php
9require 'server.inc';
10
11$ftp = ftp_connect('127.0.0.1', $port);
12if (!$ftp) die("Couldn't connect to the server");
13
14var_dump(ftp_login($ftp, 'user', 'pass'));
15
16@unlink(__DIR__.'/ftp_append_foobar');
17
18file_put_contents(__DIR__.'/ftp_append_foo', 'foo');
19var_dump(ftp_append($ftp, 'ftp_append_foobar', __DIR__.'/ftp_append_foo', FTP_BINARY));
20
21file_put_contents(__DIR__.'/ftp_append_bar', 'bar');
22var_dump(ftp_append($ftp, 'ftp_append_foobar', __DIR__.'/ftp_append_bar', FTP_BINARY));
23
24var_dump(file_get_contents(__DIR__.'/ftp_append_foobar'));
25
26ftp_close($ftp);
27?>
28--EXPECTF--
29bool(true)
30bool(true)
31bool(true)
32string(6) "foobar"
33