1--TEST-- 2Bug #39583 (FTP always transfers in binary mode) 3--SKIPIF-- 4<?php 5require 'skipif.inc'; 6?> 7--FILE-- 8<?php 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_BINARY); 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-2.php as bug39583-2.php 35