bug39583-2.phpt 676 B

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