i got an upload feild that uploads a file and the file name is stored in the database, what is happening is when the user edits something since the upload feilds are blank it over rights it with nothing in the database. so i make hidden feilds on my form that called the file name to the hidden feilds and im trying to use the if/else to say when the upload feilds are empty use the data in the hidden feild, if they arent empty process and upload the new image.
this is what i got.
$pic1 = $_POST['pic1'];//these 4 are hidden feilds that store the data of the file name when i call it to edit.
$pic2 = $_POST['pic2'];
$pic3 = $_POST['pic3'];
$pic4 = $_POST['pic4'];
if (!empty($_FILES['ipic1'])) { //ipic1 is the name up the upload feild if its not empty
$uploaddir = '/home/virtual/site30/fst/var/www/html/projects/';//this uploads to the dir
$uploadfile = $uploaddir . basename($_FILES['ipic1']['name']);
echo($_FILES['ipic1']['type']);
move_uploaded_file($_FILES['ipic1']['tmp_name'], $uploadfile);
$pic1 = $_FILES['ipic1']['name']; //this turns it to var pic1
}
else
$_FILES['ipic1'] == $pic1; // if it is empty it should pull this