Hello,
I have a form that lets people update personal info. If they go to the edit page, the textfields are populated with their info from a mysql database. They then make changes and hit submit and it updates the database. All is working great EXCEPT:
One field is a file field for images. If it is left blank on the original update I want to use a default image path in the database. ("nopic.jpg") I am having alot of trouble trying to figure out how to design it to where it will only update the file if a file was uploaded and if not to use the default image.
I am using
if(is_uploaded_file($FILES['image']['tmp_name']))
{
move_uploaded_file($FILES['image']['tmp_name'], "./bandpics/".$_FILES['image']['name']);}
and
$image = $_FILES['image']['name'];
and
$sql = "UPDATE $table SET location ='$location', image = '$image', descr = '$descr' WHERE loginName = '$loginName'";
The sad thing is I dont think I can explain it any better. If anybody has a clue as to what I'm rambling about please help.