Unable to upload files to Wiki: [[uplrejsect]] error

Unable to upload files to Wiki: [[uplrejsect]] error

by Peter Ruthven-Stuart -
Number of replies: 3
Picture of Plugin developers
Hello,

Since updating my Moodle system via CVS last Monday (the 24th September) I and students have been able unable to upload files to Wikis - the default Wiki that comes with Moodle, not NWiki, DFWikii etc.

When trying to the upload a file via the upload dialogue box below the HTML editor a new tab opens, but with no information about the file I wanted to upload. Normally, a text would appear which I'd copy into the editor to create a link to that uploaded file.

When I try to upload a file via the attachments tab I get a the following 'error message' in the attachments page:

uplrejsect

This happens with all browsers and file types.

This has been reported before: click to see previous related messages.

It has also been reported in the Moodle Tracker (MDL-6144), but at the moment there is this rather unhopeful comment: "we are not planning any non-security fixes for the old wiki - waiting for the new one smile"

I do hope that this can be fixed soon, as it renders the Wiki module rather 'un-useful'sad.

Average of ratings: -
In reply to Peter Ruthven-Stuart

Re: Unable to upload files to Wiki: [[uplrejsect]] error

by Amanda Hayler -
Just to confirm that we are also getting this error.

Amanda
In reply to Amanda Hayler

Re: Unable to upload files to Wiki: [[uplrejsect]] error

by Peter Ruthven-Stuart -
Picture of Plugin developers
Hello Amanda and anyone else trying to use the default Wiki,

In the absence of a solution to this bug (files can't be uploaded) I have come up with a workaround.

Using the Database activity module I have created an 'activity' called 'File Bank'. Students upload their files to that, and then copy the URL for the file that they want to add or link to their Wiki.

Students then access their Wiki and use the icons in the HTML editor to either add links to files in the 'File Bank', or embed images that have been saved in the 'File Bank'. This seems to work better than the original method of adding attachments to wiki pages.

Hope this idea is of use to other moodlers.
In reply to Peter Ruthven-Stuart

Re: Unable to upload files to Wiki: [[uplrejsect]] error

by Mikael Ekblom -
Hi,

we had the same problem here at our end, but I concluded that I have to hack the code myself to get it to work.

Now, the problem was in the file moodle_binary_store.php, which can be found within the directory /mod/ewiki/plugins/moodle/

The problem was that the save path and location for the file to be saved was created from the wiki name . I changed this to the following in the function moodle_binary_store_file:

function moodle_binary_store_file(&$filename, &$id, &$meta, $ext=".bin") {
# READ-Only

global $_FILES, $CFG, $course, $wiki, $groupid, $userid, $ewiki_title, $cm;
if(!$wiki->ewikiacceptbinary) {
error("This wiki does not accept binaries");
return 0;
}


$entry=wiki_get_entry($wiki, $course, $userid, $groupid);
if(!$entry->id) {
error("Cannot get entry.");
}

require_once($CFG->dirroot.'/lib/uploadlib.php');
$um = new upload_manager('upload',false,false,$course,false,0,true,true);
if ($um->process_file_uploads("$course->id/$CFG->moddata/wiki/$wiki->id/$entry->id/")) {
$filename = ''; // this to make sure we don't keep processing in the parent function
if(!$id) {
$newfilename = $um->get_new_filename();
$id = EWIKI_IDF_INTERNAL.$newfilename;
}
return true;
}
error($um->print_upload_log(true));
return false;

}




I also changed this in the function moodle_binary_get_path:

function moodle_binary_get_path($id, $meta, $course, $wiki, $userid, $groupid) {
global $CFG,$ewiki_title;

$entry=wiki_get_entry($wiki, $course, $userid, $groupid);
if(!$entry) {
error("Cannot get entry.");
}

$dir=make_upload_directory("$course->id/$CFG->moddata/wiki/$wiki->id/$entry->id/");



return "$dir";
}

So, now it reflects the wiki->id and entry->id instead. It now works for us. Hope it will help somebody else to!