0
When I use the script below it only works the first time it runs. When I try again do not send the file, just write locally. Why? I am using ftp_close
, is not enough?
When I change the host it works only for the first time.
//Definição do arquivo local
$arq = "p";
$arq .= date("YmdHis");
$arq .=".txt";
//Escreve o arquivo local
file_put_contents($arq,$conteudo_file);
//Conecta no server remoto e loga
$dados = array(
"host" => "ftp.testes.com",
"usuario" => "user",
"senha" => "password");
$fconn = ftp_connect($dados["host"]);
ftp_login($fconn, $dados["usuario"], $dados["senha"]);
//envia arquivo para o server remoto
ftp_chdir($fconn, "DataIn");
ftp_put($fconn, $arq, $arq, FTP_BINARY);
ftp_close($fconn);
unlink($arq);
the script is just that? It gives some error?
– Jorge B.
Probably some of the functions
ftp_???
is generating error but you are ignoring them. Print the return of these functions and put here what is happening (you should [Dit] the question). However read the documentation, see examples, this is not how you use these functions.– Maniero
I found that the code works, but it takes up to 50min for the file to "appear" on the remote server.
– Sandro Elias Graziosi