Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- set_time_limit(0);
- $server_ftp = 'xx.xx.xxx.xxx';
- $usuario_ftp = SQL_USUARIO;
- $senha_ftp = SQL_SENHA;
- $limitar_tamanho = 0;
- $arquivo = $_FILES['arquivo'];
- $nome_arquivo = $arquivo['name'];
- $tamanho_arquivo = $arquivo['size'];
- $arquivo_temp = $arquivo['tmp_name'];
- $destino = DIR_ARQUIVOS.$nome_arquivo;
- $conn_ftp = ftp_connect($server_ftp);
- $login_ftp = @ftp_login($conn_ftp, $usuario_ftp, $senha_ftp);
- if (!$login_ftp){exit('Usuário ou senha FTP incorretos.');}
- if (@ftp_put($conn_ftp, $destino, $arquivo_temp, FTP_BINARY))
- {
- echo 'Arquivo enviado com sucesso!';
- } else {echo 'Erro ao enviar arquivo!'; }
- // Fecha a conexão FTP
- ftp_close( $conn_ftp );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement