There is a form where the user can add an image, it is necessary that it be saved to an FTP server. All sites have the same example, on the basis of which such code was created ...
$filep = $_FILES['foto']['tmp_name']; $ftp_server = 'xx.xxx.xx.xxx'; $ftp_user_name = 'admin'; $ftp_user_pass = 'xxxxxxxxxxx'; $paths = "/АРХИВ/".$filep; $name = $_FILES['foto']['name']; $conn_id = ftp_connect($ftp_server); $login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass); if ((!$conn_id) || (!$login_result)) { echo "Соединение не установлено!"; echo "Попытка подключения $ftp_server для пользователя: $ftp_user_name"; exit; } else { echo "Соединение установлено $ftp_server для пользователя: $ftp_user_name"; } $upload = ftp_put($conn_id, $paths. '/'.$name, $filep, FTP_BINARY); if (!$upload) { echo "Загрузка не выполнена!"; } else { echo "Выполнена загрузка $name на $ftp_server"; } ftp_close($conn_id); set_time_limit(300); As a result, there is nothing on the server) is there a problem in the code? Or is it necessary to change something in the settings of the FTP server itself? Unfortunately online examples on this topic are hard to find ...
ftp_pasv($conn_id, true)before downloading. And also try replacingftp_putwithftp_rawand see what the server really returns - Anton Shchyrov