Advertisement
Guest User

Untitled

a guest
Mar 27th, 2017
49
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.66 KB | None | 0 0
  1. <?php
  2. set_time_limit(0);
  3. $server_ftp = 'xx.xx.xxx.xxx';
  4.  
  5. $usuario_ftp = SQL_USUARIO;
  6. $senha_ftp = SQL_SENHA;
  7.  
  8. $limitar_tamanho = 0;
  9.  
  10. $arquivo = $_FILES['arquivo'];
  11. $nome_arquivo = $arquivo['name'];
  12. $tamanho_arquivo = $arquivo['size'];
  13. $arquivo_temp = $arquivo['tmp_name'];
  14.  
  15. $destino = DIR_ARQUIVOS.$nome_arquivo;
  16.  
  17. $conn_ftp = ftp_connect($server_ftp);
  18. $login_ftp = @ftp_login($conn_ftp, $usuario_ftp, $senha_ftp);
  19.  
  20. if (!$login_ftp){exit('Usuário ou senha FTP incorretos.');}
  21.  
  22. if (@ftp_put($conn_ftp, $destino, $arquivo_temp, FTP_BINARY))
  23. {
  24. echo 'Arquivo enviado com sucesso!';
  25. } else {echo 'Erro ao enviar arquivo!'; }
  26.  
  27. // Fecha a conexão FTP
  28. ftp_close( $conn_ftp );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement