are you putting the image form on the detail page?
On the detail page, the ID is passed in as a querystring variable.
In the form you add to the detail page, create a hidden form element to capture this querytring variable value.
When the form is submitted to upload the file, store the image name in one column, and relate it to the dog by the value stored in the hidden form element.