diff --git a/question/format/hotpot/format.php b/question/format/hotpot/format.php
index <HASH>..<HASH> 100644
--- a/question/format/hotpot/format.php
+++ b/question/format/hotpot/format.php
@@ -48,7 +48,9 @@ class qformat_hotpot extends qformat_default {
 
         // get import file name
         global $params;
-        if (isset($params) && !empty($params->choosefile)) {
+        if (! empty($this->realfilename)) {
+            $filename = $this->realfilename;
+        } else if (isset($params) && !empty($params->choosefile)) {
             // course file (Moodle >=1.6+)
             $filename = $params->choosefile;
         } else {
MDL-<I>: fix setting of absolute urls for images in subfolders of course files