hatrickpatrick Posted August 21, 2007 Share Posted August 21, 2007 Ok, here's the story: I'm making a form to upload a file. I haven't put in the restrictions yet, I'll do that when the form is actually working... But the problem is my php server has a file size limit, so I want to use ftp_put to move the file to another server. I tested the other server with a simple ftp_put test yesterday, so I know it works... So now, I want php to assign a random number to the end of the new filename, and send it over to the new server. It's not working though - can anyone help? My code so far: <? if ($submit) { /* connect to the server */ $filen=$FILES['file']['tmp_name']; $rand=rand(1,1000); $file_path="'$filen' _ '$rand'"; $conn_id = ftp_connect('ftp.hyperphp.com'); $login_result = ftp_login($conn_id, 'hp_933282', 'vse7wr'); ftp_pasv($conn_id, true); ftp_put($conn_id, '/u2patches.hyperphp.com/htdocs/temp_files/$file_path', $file, FTP_ASCII); echo "worked<br>"; echo "$file_path"; ftp_close($conn_id); } ?> <form action=ftp_test.php method=post> <input type=file name=file><br> <input type=submit name=submit value-=submit> </form> Sorry the code is so crude, this is just a first draft of the form, I'll add everything else in when this bit is done... Quote Link to comment Share on other sites More sharing options...
Wuhtzu Posted August 21, 2007 Share Posted August 21, 2007 Exactly what is not working? Quote Link to comment 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.