Please help uploading images

Hi all,
I have the following code to upload an image and save the path to my DB:

[code]

<?php $uploadDir = '../uploads/'; if(isset($_POST['upload'])) { $fileName = $_FILES['userfile']['name']; $tmpName = $_FILES['userfile']['tmp_name']; $fileSize = $_FILES['userfile']['size']; $fileType = $_FILES['userfile']['type']; if($fileName==""){ $filePath = '../uploads/img/none.jpg'; } else{ $filePath = $uploadDir . $fileName; } $filePath = str_replace(" ", "_", $filePath); $result = move_uploaded_file($tmpName, $filePath); if(!get_magic_quotes_gpc()) { $fileName = addslashes($fileName); $filePath = addslashes($filePath); } $categoria = $_POST["id_categoria"]; $subcategoria = $_POST["id_subcategoria"]; $fabricante = $_POST["fabricante"]; $articuloesp = $_POST["articulo_esp"]; $articulocat = $_POST["articulo_cat"]; $precio = $_POST["precio"]; $descripcionesp = $_POST["descripcion_esp"]; $descripcioncat = $_POST["descripcion_cat"]; if(isset($_POST['novedad'])){ $novedad = 'si'; } else{ $novedad = 'no'; } $query = "INSERT INTO lacteosp.t_articulo (id_categoria,id_subcategoria,fabricante,articulo_esp,articulo_cat,precio,descripcion_esp,descripcion_cat,novedad,articulo_image) ". "VALUES ('$categoria','$subcategoria','$fabricante','$articuloesp','$articulocat','$precio','$descripcionesp','$descripcioncat','$novedad','$filePath')"; mysql_query($query) or die('Error, query failed : ' . mysql_error()); //echo "
Files uploaded
"; header("Location: PC_products_inserted.php"); } ?>[/code]

This works fine…but I need now to upload 2 images for the same record and save the 2 paths to my DB.
Can my upload code be modified to achieve this?
I am very new to PHP…so please help.
Thanks

Sponsor our Newsletter | Privacy Policy | Terms of Service