greengo Posted May 15, 2007 Share Posted May 15, 2007 Does anyone know why this script doesn't work? <?php $file = $_FILES['file']; $ftpServer = "ftp.prohosts.org"; $ftpUser = "username"; $ftpPass = "**************"; $post_dir= "files/"; if($file) { echo "got data"; $conn = ftp_connect($ftpServer) or die("Cannot initiate connection to host"); $login = ftp_login($conn, $ftpUser, $ftpPass) or die("Cannot login" ); echo "Sending"; $upload = ftp_put($conn, $post_dir, $file, FTP_BINARY); } else { echo "haven't got data!!!"; } if($upload) { echo "<table width='500' border='0'><tr><td><div align='center'><h2>File uploaded OK.</h2></div></td></tr><tr><td><div align='center'><a href='http://greengo.orgfree.com/upload'><h3>GO BACK<h3></a></div></td></tr></table>"; } else { echo "<table width='500' border='0'><tr><td><div align='center'><h2>File upload failed.</h2></div></td></tr><tr><td><div align='center'><a href='http://greengo.orgfree.com/upload'><h3>GO BACK<h3></a></div></td></tr></table>"; } ftp_quit($conn); ?> Link to comment https://forums.phpfreaks.com/topic/51413-ftp-php/ Share on other sites More sharing options...
john010117 Posted May 15, 2007 Share Posted May 15, 2007 Do you have any error messages? Post the error message here if you do. Link to comment https://forums.phpfreaks.com/topic/51413-ftp-php/#findComment-253187 Share on other sites More sharing options...
greengo Posted May 15, 2007 Author Share Posted May 15, 2007 no it just returns echo"got data"; and then nothing. Link to comment https://forums.phpfreaks.com/topic/51413-ftp-php/#findComment-253190 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.