forked from php/php-src
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathftp_append.phpt
42 lines (36 loc) · 945 Bytes
/
ftp_append.phpt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
--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'));
$fooPath = __DIR__ . '/ftp_append_foo';
file_put_contents($fooPath, 'foo');
var_dump(ftp_append($ftp, 'ftp_append_foobar', $fooPath, FTP_BINARY));
$barPath = __DIR__ . '/ftp_append_bar';
file_put_contents($barPath, 'bar');
var_dump(ftp_append($ftp, 'ftp_append_foobar', $barPath, FTP_BINARY));
$fooBarPath = __DIR__ . '/ftp_append_foobar';
var_dump(file_get_contents($fooBarPath));
ftp_close($ftp);
?>
--CLEAN--
<?php
$fooPath = __DIR__ . '/ftp_append_foo';
unlink($fooPath);
$barPath = __DIR__ . '/ftp_append_bar';
unlink($barPath);
$fooBarPath = __DIR__ . '/ftp_append_foobar';
unlink($fooBarPath);
?>
--EXPECTF--
bool(true)
bool(true)
bool(true)
string(6) "foobar"