Hello, I have this code that generates in the case of multiple additives with everything I'm not sure how to make an image upload code to upload all the images that are placed in the FILE field of < strong> file [] could anyone help me to complement the code.
In case I need the code to upload to the media folder, apply scaling, then mark and upe all the images and add the image values in arquivo
= '". $ imageImage [$ values ]. "' I also thank you for being able to help me.
Below is the code that I did with everything without the image upload code. I'm still starting my PHP course and there's a lot I still do not know how to do.
I've just been able to do just the repeat code using for and add the values directly to the database .
index.php
<form id="form1" name="form1" method="post" action="multiplicar.php">
Coloque aqui o numero de episodios que vc ira adicionar
<label>
<input type="text" name="numeros" id="numeros" style="width:20px;" />
</label>
<label>
<input type="submit" name="button" id="Gerar" value="Gerar" />
</label>
</form>
multiplicar.php
<form id="form1" enctype="multipart/form-data" name="form1" method="post" action="salvar.php">
<?php
$valor = $_POST["numeros"];
for ($repeticao = 1; $repeticao <= $valor; $repeticao++) { ?>
<label>
Nome <input name="categorias[]" type="text" id="numero" value="" size="10" /> Tipos <input name="tipos[]" type="text" id="tipos" value="" size="10" /></br>
Imagem <input name="arquivo[]" type="file" id="arquivo[]" style="border:0px; width:249px;box-shadow: 0px 0px 2px #5B5B5B;border-radius:0px; font-family:'Arial'; font-size:14px; padding-left:0px; padding-right:0px;"/>
</label>
<? } ?>
<input type="submit" name="button" id="button" value="Enviar" />
</form>
save.php
<?php
$categoria = $_POST["categorias"];
$tipo = $_POST["tipos"];
$arquivoImagem = $_POST["arquivo"];
$numeracao = 1;
foreach($categoria as $valores => $maiorIgual) {
// Faz a inserção dos dados na MYSQL
$sql = "INSERT INTO 'medias' SET 'cat'='".$categoria[$valores]."', 'tipos'='".$tipo[$valores]."', 'arquivo'='".$arquivoImagem[$valores]."'";
$consulta = mysql_query($sql);
if($consulta) {
echo'<center>';
echo " Item ".$numeracao++." Cadastrado com Sucesso<br/>";
}else{
echo " Item ".$numeracao++." Erro ao cadastrar<br/>";
echo'</center>';
}
} ?>