diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php
index abb2d604b95..1d306a01143 100644
--- a/htdocs/core/class/html.formfile.class.php
+++ b/htdocs/core/class/html.formfile.class.php
@@ -969,10 +969,7 @@ class FormFile
$out .= '
';
- $documenturl = DOL_URL_ROOT.'/document.php';
- if (isset($conf->global->DOL_URL_ROOT_DOCUMENT_PHP)) {
- $documenturl = getDolGlobalString('DOL_URL_ROOT_DOCUMENT_PHP'); // To use another wrapper
- }
+ $documenturl = getDolGlobalString('DOL_URL_ROOT_DOCUMENT_PHP', DOL_URL_ROOT.'/document.php'); // DOL_URL_ROOT_DOCUMENT_PHP can be used to set another wrapper
// Show file name with link to download
$imgpreview = $this->showPreview($file, $modulepart, $relativepath, 0, $param);