I now have a file uploader that goes on like this
This is the index.php:
<form action="sendfotos.php" method="post" enctype="multipart/form-data">
Imagem: <input name="imagen" type="file" size="35"> <br />
<input name="submit" type="submit" value="Upload">
</form>
This is the sendfotos.php:
<?php
$conexion=mysql_connect("host","user","password")or die("Problemas en la conexion");
mysql_select_db("bdname",$conexion) or
die("Problemas en la seleccion de la base de datos");
$nomimagen= $_FILES['imagen']['name'];
if(move_uploaded_file ( $_FILES [ 'imagen' ][ 'tmp_name' ], '../gallery/user/'.$_FILES [ 'imagen' ][ 'name' ])) {
echo "<link rel='stylesheet' href='adminstyle.css' type='text/css' media='all'><div id='page'><div id='agendasend'><br><br>Midia añadido con exito<br><br><br><a href='fotos.php'>Volver</a></div></div>";
mysql_query("insert into galeriafotos (imagen,id) values
('$nomimagen','$_REQUEST[id]')");
} else{
echo "There was an error uploading the file, please try again!";
}
?>
But now I need to use a multiuploader, which is the best solution? Upload multiple files at once and still save each one of them in the MySQL database.
Thanks in advance
Create function that moves uploaded file into your photo folder and inserts it into database then iterate over multiple files received by POST and call that function on each one. This is for not repeating code.