Sorry if the title sounds a bit vague.

Stackoverflow posting newbie here.

I have an address book that I am building and have run into a bit of a problem.

I want to be able to update the record and if no image is set in the update form, to keep the image already noted in the record. If the image field is populated, then update the record with that image and move it to the target location.

This is the if statement I have for it:

```
if (empty($photo))
{
$photo = $row['photo'];
}
else
{           
$phmsg = "Photo $photo has been deleted and replaced";
unlink("".IMAGES."/$photo");
$afn = date('dmYHis');
$name_of_file = $_FILES['photo']['name'];
$photo=$afn.$name_of_file;
$target = "".FILE_UPLOAD."/"; 
$target = $target . basename($photo);
}

```

This is the error I get when I try to run the upload:

> 
> Warning: move\_uploaded\_file() [function.move-uploaded-file]: Filename cannot be empty in C:\xampp\htdocs\cab\update.php on line 165
> 
> 
> Warning: move\_uploaded\_file() [function.move-uploaded-file]: Unable to move 'C:\xampp\tmp\phpB232.tmp' to '' in C:\xampp\htdocs\cab\update.php on line 165
> 
> 
> File was not uploaded. Please try a manual upload.
> 
> 
> 

The only other way around it that I can see is to have a seperate file for updating and not updating the picture.

Any help would be most welcome and very much appreciated.

Thanks in advance