1
Colleagues.
I am wanting to get the data from a txt file that contains the name and registration of the user. Ex.:
Fernando Pessoa; 000011;
Ruth Cardoso; 000012;
....
Trying to take it that way:
$diretorio = 'arquivos/';
$arquivos = $diretorio . $_FILES['dados']['name'];
if (move_uploaded_file($_FILES['dados']['tmp_name'], $diretorio . $_FILES['dados']['name'])) {
$ler = fopen($arquivos,"r");
$conteudo = fread($ler,filesize($arquivos));
$dividir = explode(";",$conteudo);
foreach($dividir as $valores){
echo $dividir[0]." => ".$dividir[1]."<br>";
// aqui faço o cadastro
}
}
It returns only the first name and registration repeating as the total amount of data registered in txt. If you have 30 names and registrations, is bringing 30 times Fernando Pessoa 000011 and not the other data
Perfect Miguel. It worked. Thank you !
– user24136
@Fox.11 After reading the file close the Handle with
fclose($ler)
.– stderr
You’re welcome @Fox.11. I’m glad
– Miguel
@zekk, obsessed I’ll edit accordingly, forgot
– Miguel