0
Hello guys I’m developing a site, but I’m still a little layy and a friend of mine was helping me, but now I can not help me.
Well my doubt is the following how do I upload more than one image because this system that he set up for me gives to upload one and one image, and that would take too long for the client.
Php code:
<form method="post" style="margin-left: 400px;" enctype="multipart/form-data">
<div id="queue"></div>
<input name="imagem" type="file">
<input type="submit" name="up" value="upado">
</form>
<?php
if (isset($_POST['up']) && $_POST['up'] == "upado") {
if (count($_FILES) > 0) {
$img = $_FILES['imagem'];
$ff = md5(sha1($img['name'])).".jpg";
if (move_uploaded_file($img['tmp_name'], "../fotos/".$ff)) {
$sql = "insert into imoveis_fotos (foto_imovel,foto_nome)";
$sql .=" values ({$imv_id},'{$ff}')";
mysql_query($sql);
header("refresh:1;url=?pag=imoveis_fotos&id=".$imv_id);
}
}
}
?>
I think it will be of greater value if you seek to learn how the code works to try to change it for yourself than if we change it for you. The idea is simple: create several file type fields with
name=imagem[]
, so in PHP you will have all the$_FILES
, repeating this same logic of the question for each of them.– Woss
Thanks, I’m doing some research I think I got it
– Rogerio
See if it helps: http://php.net/manual/en/features.file-upload.multiple.php
– Don't Panic
thanks for the personal help, I got
– Rogerio