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); ?> Quote 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. Quote 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. Quote Link to comment https://forums.phpfreaks.com/topic/51413-ftp-php/#findComment-253190 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.