diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php
index c467f7aaa84..97ecce50a15 100644
--- a/htdocs/core/class/html.formfile.class.php
+++ b/htdocs/core/class/html.formfile.class.php
@@ -770,15 +770,18 @@ class FormFile
print '';
+ print '&file='.urlencode($relativepath.$file['name']);
+ /* Restore old code: When file is at level 2+, full relative path must be in url, not only level1
if ($file['level1name'] <> $object->id)
$filepath=urlencode($object->id.'/'.$file['level1name'].'/'.$file['name']);
else
$filepath=urlencode($object->id.'/'.$file['name']);
- print '&file='.$filepath.'">';
+ print '&file='.$filepath;
+ */
+ print '">';
print img_mime($file['name'],$file['name'].' ('.dol_print_size($file['size'],0,0).')').' ';
- if ($showrelpart == 1) print $file['level1name'].'/';
+ if ($showrelpart == 1) print $relativepath;
print dol_trunc($file['name'],$maxlength,'middle');
print '';
print "\n";