carlitoway Posted September 19, 2013 Share Posted September 19, 2013 I have this code and it works perfect with one image, but I need to upload more images (10) , can someone please help me with this problem...??? this is my Code <!DOCTYPE html> <html> <body> <h2>Subir imagen</h2> <form method="POST" enctype="multipart/form-data" action="<?php echo htmlentities($_SERVER['PHP_SELF']); ?>" > <input type="file" name="imagen"/> <input name="enviar" type="submit" value="Enviar"/> </form> </body> </html> <?php $host = "localhost"; $user = "root"; $pw = ""; $bd = "base"; $conexion=mysql_connect('localhost','root','') or die ('no hay conexion a la base de datos'); $db=mysql_select_db('base',$conexion) or die ('no existe la base de datos'); $RutaServidor='imagenes-de-usuarios'; $RutaTemporal=$_FILES['imagen']['tmp_name']; $NombreImagen=$_FILES['imagen']['name']; $SizeImagen=$_FILES['imagen']['size']; $rutaDestino=$RutaServidor.'/'.$SizeImagen.$NombreImagen; move_uploaded_file($RutaTemporal,$rutaDestino); $sql="INSERT INTO imagenes (ruta) values ('".$rutaDestino."')"; $respuesta=mysql_query($sql,$conexion); if ($respuesta){ echo ' <div class="subido"> <h2>Imagen guardada con exito</h2> <br> <h2 class="close-window2">Continuar</h2> </div>'; }else { echo 'no se puedo guardar la imagen intentelo de nuevo'; } ?> Quote Link to comment https://forums.phpfreaks.com/topic/282291-how-to-upload-multiples-images-and-strore-link-on-database/ Share on other sites More sharing options...
jazzman1 Posted September 19, 2013 Share Posted September 19, 2013 You should consider using some javascript multiple file uploading API to do that. I recommend plupload. Quote Link to comment https://forums.phpfreaks.com/topic/282291-how-to-upload-multiples-images-and-strore-link-on-database/#findComment-1450311 Share on other sites More sharing options...
DFulg Posted September 19, 2013 Share Posted September 19, 2013 If you would like to do this using strictly markup and PHP, I suggest taking a look a this and this. Note that the "multiple" attribute is not supported in IE or Opera. Quote Link to comment https://forums.phpfreaks.com/topic/282291-how-to-upload-multiples-images-and-strore-link-on-database/#findComment-1450318 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.