diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php
index fb618813f56..4a0114b5244 100644
--- a/htdocs/core/class/html.formfile.class.php
+++ b/htdocs/core/class/html.formfile.class.php
@@ -7,7 +7,7 @@
* Copyright (C) 2014 Marcos García
* Copyright (C) 2015 Bahfir Abbes
* Copyright (C) 2016-2017 Ferran Marcet
- * Copyright (C) 2019 Frédéric France
+ * Copyright (C) 2019-2021 Frédéric France
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -966,6 +966,7 @@ class FormFile
// Loop on each file found
$found = 0;
+ $i = 0;
foreach ($file_list as $file) {
$i++;
if ($filter && !preg_match('/'.$filter.'/i', $file["name"])) {