bug39583.phpt 684 B

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