PHP Send a file via FTPI was having some trouble successfully sending files, until I set FTP PASSIVE to true.
$ftp_server="ftp.someserver.net"; $ftp_username="username"; $ftp_password="password"; $ftp_filename="somefiletotransfer.zip"; $ftp_fd = ftp_connect($ftp_server); $ftp_login = ftp_login($ftp_fd, $ftp_username, $ftp_password ); // check connection if ((!$ftp_fd) || (!$ftp_login)) die("FTP connection has failed!"); echo "* ftpconnect: success"."\n"; ftp_pasv($ftp_fd, true); echo "* pwd : ".ftp_pwd( $ftp_fd )."\n"; echo "* ls : " .print_r( ftp_nlist($ftp_fd, "."),true )."\n"; // upload the file $ftp_upload = ftp_put($ftp_fd, $ftp_filename, $ftp_filename, FTP_BINARY); ftp_close($ftp_fd); // check upload status if (!$ftp_upload) die("FTP upload has failed!"); echo "* ftpupload: success"."\n"; Tags: php | Related Articles php Calculate Script Duration in PHP and... Generate CSV Spreadsheet with PHP Generate PDFs with PHP Generate XLS Spreadsheet files with ... How to properly escape inline javasc... HTML Table Row Highlight PHP - Resize an Image with GD PHP Calculate Duration of MP3 PHP Create Zip file PHP mail Function With Attachments |