Bueno tengo este script que me sube una imagen al servidor, pero ahora se me piden 4 imagenes...pero no se como ligar los tres formularios tipos "file"........para que me suba 4 imagenes y otros datos a la BD
Alguna Ayudita?:
Código PHP:
<?php
if ($HTTP_POST_VARS['submit']) {
//print_r($HTTP_POST_FILES);
if (!is_uploaded_file($HTTP_POST_FILES['file']['tmp_name'])) {
$error = "No hay ningun archivo!";
unlink($HTTP_POST_FILES['file']['tmp_name']);
// assign error message, remove uploaded file, redisplay form.
} else {
//a file was uploaded
$maxfilesize=1048576;//1024
if ($HTTP_POST_FILES['file']['size'] > $maxfilesize) {
$error = "La imagen es muy grande";
unlink($HTTP_POST_FILES['file']['tmp_name']);
// assign error message, remove uploaded file, redisplay form.
} else {
if ($HTTP_POST_FILES['file']['type'] != "image/gif" AND $HTTP_POST_FILES['file']['type'] != "image/pjpeg") {
$error = "este tipo de archivo no es valido";
unlink($HTTP_POST_FILES['file']['tmp_name']);
// assign error message, remove uploaded file, redisplay form.
} else {
//File has passed all validation, copy it to the final destination and remove the temporary file:
if ($HTTP_POST_FILES['file']['type']=='image/pjpeg') {
$extension = substr ($HTTP_POST_FILES['file']['type'], 7);
} else {$extension = substr ($HTTP_POST_FILES['file']['type'], 6);};
$extension = substr ($HTTP_POST_FILES['file']['type'], 7);
if (chop($photo)==''){$photo=substr ($HTTP_POST_FILES['file']['name'], 0);};
$NombreD=$photo.'.'.$extension;
if (copy($HTTP_POST_FILES['file']['tmp_name'],chop("cars/images/ ").$NombreD)) {
unlink($HTTP_POST_FILES['file']['tmp_name']);
print "La imagen ha sido descargada en el servidor!";
include('ok.php');
};
exit;
}
}
}
}
?>