0
Hello I have this code that generates in the case of multiple adders with everything I’m not sure how to make an image upload code to upload all the images that are placed in FILE of the field of filing cabinet[ ] someone could help me supplement the code .
In case I need the code to upload to the medium folder, apply resizing, logo tag and Upe all images and add the values of the image in arquivo
='".$archiveImage[$values]."' also since thank you who can help me.
Below is the code I did with everything without the image upload code. I’m still starting my course in PHP and there’s a lot I don’t know how to do.
I only managed to do only in case the repeat code using the for and add direct values to 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>
multiply.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>';
}
} ?>
I already solved the problem of posting that was taken off the air -__- I thank Rafael Withoeft for the help provided in chat http://pastebin.com/xaF1PcKy
– Striffer
@Rodrigo you must refer to another question that you asked, that was closed, it did not come off the air. I must tell you that the questions here are simply not closed by wickedness, has grounds and is in line with community standards for good organization and other criteria. Don’t take this the wrong way I’ve had two questions of my own, I’ve just read the "Help" to better understand how to formulate a good question and refit (or edit) them to stay within the "scope".
– Guilherme Nascimento