xref: /php-src/ext/ftp/tests/bug39583-2.phpt (revision e9f783fc)
1--TEST--
2Bug #39583 (FTP always transfers in binary mode)
3--EXTENSIONS--
4ftp
5pcntl
6--FILE--
7<?php
8require 'server.inc';
9
10$ftp = ftp_connect('127.0.0.1', $port);
11if (!$ftp) die("Couldn't connect to the server");
12
13var_dump(ftp_login($ftp, 'user', 'pass'));
14
15$source_file = __FILE__;
16$destination_file = basename(__FILE__);
17
18// upload the file
19$upload = ftp_put($ftp, $destination_file, $source_file, FTP_BINARY);
20
21// check upload status
22if (!$upload) {
23       echo "FTP upload has failed!";
24   } else {
25       echo "Uploaded $source_file as $destination_file";
26   }
27
28// close the FTP stream
29ftp_close($ftp);
30?>
31--EXPECTF--
32bool(true)
33Uploaded %sbug39583-2.php as bug39583-2.php
34