xref: /php-src/ext/ftp/tests/bug39583.phpt (revision e9f783fc)
1--TEST--
2Bug #39583 (FTP always transfers in binary mode)
3--EXTENSIONS--
4ftp
5pcntl
6--FILE--
7<?php
8$bug39583=1;
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$source_file = __FILE__;
17$destination_file = basename(__FILE__);
18
19// upload the file
20$upload = ftp_put($ftp, $destination_file, $source_file, FTP_ASCII);
21
22// check upload status
23if (!$upload) {
24       echo "FTP upload has failed!";
25   } else {
26       echo "Uploaded $source_file as $destination_file";
27   }
28
29// close the FTP stream
30ftp_close($ftp);
31?>
32--EXPECTF--
33bool(true)
34Uploaded %sbug39583.php as bug39583.php
35