From 9259bf1c0ed4a7105686771e6830e6b7c4e64734 Mon Sep 17 00:00:00 2001 From: thepurpleblob Date: Thu, 28 Jun 2007 15:13:52 +0000 Subject: [PATCH] MDL-10234 Encoded images in subdirectories failed to load. Thanks to Enrique Castro for fix. --- question/format.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/question/format.php b/question/format.php index ace02c6131d..4a774339251 100644 --- a/question/format.php +++ b/question/format.php @@ -364,6 +364,9 @@ class qformat_default { $destination = $path_parts['dirname']; $file = clean_filename( $path_parts['basename'] ); + // check if path exists + check_dir_exists($destination, true, true ); + // detect and fix any filename collision - get unique filename $newfiles = resolve_filename_collisions( $destination, array($file) ); $newfile = $newfiles[0]; @@ -382,6 +385,7 @@ class qformat_default { fclose( $fh ); // return the (possibly) new filename + $newfile = ereg_replace("{$CFG->dataroot}/{$this->course->id}/", '',$newfullpath); return $newfile; }