diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php
index 675300169e4..80cd8bb79e2 100644
--- a/htdocs/core/class/html.formfile.class.php
+++ b/htdocs/core/class/html.formfile.class.php
@@ -1782,6 +1782,8 @@ class FormFile
$result = 0;
if (is_object($object_instance)) {
+ $object_instance->id = 0;
+ $object_instance->ref = '';
if ($id) {
$result = $object_instance->fetch($id);
} else {