--- filepicker.php.original 2011-09-26 16:16:49.036005878 +0200 +++ filepicker.php 2011-09-26 17:52:11.050787048 +0200 @@ -112,13 +112,12 @@ function exportValue(&$submitValues, $assoc = false) { global $USER; - $draftitemid = $this->_findValue($submitValues); - if (null === $draftitemid) { + if (!$draftitemid = (int)$this->_findValue($submitValues)) { $draftitemid = $this->getValue(); } // make sure max one file is present and it is not too big - if (!is_null($draftitemid)) { + if ($draftitemid) { $fs = get_file_storage(); $usercontext = get_context_instance(CONTEXT_USER, $USER->id); if ($files = $fs->get_area_files($usercontext->id, 'user', 'draft', $draftitemid, 'id DESC', false)) {