I need some advice, or better, am I doing right.
The user can upload an image on a profile update page. Will say, the image filed is empty.
And I store nothing in the hidden field for the current image.
The new image, if the user uploads an image gets a random password (SA) that I store in a session when button pressed.
So, am I right, that I need 2 triggers for the old image delete function?
Cause, if the hidden field for the current image is empty I get an error message.
Then I need an other trigger to check if an upload was done, to delete the old image.
if there is no image, take the hidden field (current image) as default in the upload, and so it stays empty.
in case of upload a new image, the hidden field is not empty, the upload is done, so the old image can be deleted.
is this the right way, or is there an other, better way to do this.