php - Moving an uploaded file onto a remote server -
i trying move uploaded file onto remote server, isn't working;
move_uploaded_file($tmp_name, "uploads/$code1/$code.$fileex");
$ftp_server = "ip"; $ftp_user_name = "username"; $ftp_user_pass = "password"; $file = $tmp_name; $remote_file = "/public_html/test/uploads/"; // set basic connection $conn_id = ftp_connect($ftp_server); // login username , password $login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass); // upload file if (ftp_put($conn_id, $remote_file, $file, ftp_ascii)) { echo "successfully uploaded $file\n"; } else { echo "there problem while uploading $file\n"; } // close connection ftp_close($conn_id);
i erorr;
warning: ftp_put() [function.ftp-put]: can't open file: directory in /home/file/public_html/uploaded.php on line 52
your $remote_file
variable pointing directory when should point file. try changing $remote_file $remote_file = "/public_html/test/uploads/".$file;
Comments
Post a Comment