I don't think you understand.....
The code that I posted is not where you specify the file to be uploaded.
The code is what processes the specified file for upload, as in:
1) renames the file based on 2 inputted variables on the submit page.
2) adds the proper filename to the record in the db table.
3) places the renamed file into the proper directory for recall later...
The original code works just fine for the upload and rename..... however what I need to do is have the processing figure out if the user did not specify a file for upload. If the user did not upload a image, then I want the system to default to a standard "no image" file, and display that....
The no image file will be a standard file on the system, so there would be no reason to rename the file, I need to skip the renaming part:
$filename = $_FILES['fupload']['name']; // original file name
$filebeg = $_POST['constid']; // first variable for new name
$filesec = $_POST['warnum']; // second variable for new name
$newfilename = $filebeg."_".$filesec.".jpg"; // creation of new filename
and just have the filename be specified as:
$newfilename = "nofile.jpg"
I'm just not sure that the format below is correct:
if $_FILES['fupload'] = '' {
$newfilename = "nofile.jpg"
}
else
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);
}