summaryrefslogtreecommitdiff
path: root/ext/ftp/tests/bug39583-2.phpt
blob: 0a8423d3913ed6614c83fb292fcbbe777c2730b3 (plain)
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
--TEST--
Bug #39583 (FTP always transfers in binary mode)
--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'));

$source_file = __FILE__;
$destination_file = basename(__FILE__);

// upload the file
$upload = ftp_put($ftp, $destination_file, $source_file, FTP_BINARY);

// check upload status
if (!$upload) {
       echo "FTP upload has failed!";
   } else {
       echo "Uploaded $source_file as $destination_file";
   }

// close the FTP stream
ftp_close($ftp);
?>
--EXPECTF--
bool(true)
Uploaded %sbug39583-2.php as bug39583-2.php