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