0
I need to send files above 2GB, and I ended up reading that it is better to use FTP, searched a little and got this code:
uploadFTP.php
<?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 );
The problem is that in my case, I have a form(POST
) with a <input type="file">
that I use if(isset($_POST['fileInputName']))
this way to move(move_uploaded_file
) the file that was uploaded, but I would like a way to upload (multiple files in the same input) by the FTP code above, and still be able to use the isset
.
Dude, I gave an answer, but I ended up answering only the end of the question (it’s good to avoid asking more than one question in the same question).
– Daniel