Below is the code that I have for uploading images to the server, which generates a file name based on 2 entries of the form....
I need to be able to put a "no image" picture in if the user does not upload a photo.... I am submitting the original code along with what I am trying... any help is appreciated...
Thanks
Rob
Original Code
if (isset ($_FILES['fupload'])){
$filename = $_FILES['fupload']['name'];
$filebeg = $_POST['constid'];
$filesec = $_POST['warnum'];
$newfilename = $filebeg."_".$filesec.".jpg";
$_SESSION['newfilename'] = $newfilename;
$source = $_FILES['fupload']['tmp_name'];
$target = "uploads/images/".$newfilename;
move_uploaded_file($source, $target);
}
This should work (I think).... any help?
if (isset ($_FILES['fupload'])){
if $_FILES['fupload'] = ' ' {
$newfilename = "nofile.jpg"
}
else
$filename = $_FILES['fupload']['name'];
$filebeg = $_POST['constid'];
$filesec = $_POST['warnum'];
$newfilename = $filebeg."_".$filesec.".jpg";
$_SESSION['newfilename'] = $newfilename;
$source = $_FILES['fupload']['tmp_name'];
$target = "uploads/images/".$newfilename;
move_uploaded_file($source, $target);
}