Hi
The below code loads a file to a folder and stores the file name in a mysql database. How would I change it so that I can add two files at the same time. I have to file fields on the form.
thank you for any help
[code=php]
if (isset($_FILES[‘file’])) {
$path = ‘../adImages/’;
if (is_uploaded_file($_FILES[‘file’][‘tmp_name’])) {
if ($_FILES[‘file’][‘size’]>$max_file_size) {
$msg = “Image Exceeds maximum file size”;
header(“location: $url?msg=$msg”);
exit;
}
if (($_FILES[‘file’][‘type’]==”image/gif”) || ($_FILES[‘file’][‘type’]==”image/pjpeg”) || ($_FILES[‘file’][‘type’]==”image/jpeg”) || ($_FILES[‘file’][‘type’]==”image/png”)) {
if (file_exists($path . $_FILES[‘file’][‘name’])) {
$msg .= “The file already exists, change your file name”;
header(“location: $url?msg=$msg”);
exit;
}
$res = copy($HTTP_POST_FILES[‘file’][‘tmp_name’], $path.$user_name.”-“.$HTTP_POST_FILES[‘file’][‘name’]);
if (!$res) {
$msg .= “upload failed!”;
header(“location: $url?msg=$msg”);
exit;
}
} else {
header(“location: $url?msg=$msg”);
$msg .=”Wrong file type, Must be jpeg, gif or png file types”; exit; }
$image = $user_name.”-“.$HTTP_POST_FILES[‘file’][‘name’];
}