From 16ffe14a93583533b119dee8ad472ecd5c3ed65e Mon Sep 17 00:00:00 2001 From: mjollnir_ Date: Wed, 15 Sep 2004 22:07:27 +0000 Subject: [PATCH] Integration of new centralised upload code with wiki/wikifiles.php - this is the choose initial page part, not the upload a page into the wiki part. These patches are maintained in an publicly accessible Arch repository, see: http://lists.eduforge.org/cgi-bin/archzoom.cgi/arch-eduforge@catalyst.net.nz--2004-MIRROR/moodle--eduforge--1.3.3 Index of arch patches in this commit: arch-eduforge@catalyst.net.nz--2004/moodle--eduforge--1.3.3--patch-63 2004-09-15 21:56:38 GMT Penny Leach wikifiles integration with upload class - this is just the initial page part, not the upload a file into the wiki parg Full logs: Revision: moodle--eduforge--1.3.3--patch-63 Archive: arch-eduforge@catalyst.net.nz--2004 Creator: Penny Leach Date: Thu Sep 16 09:56:38 NZST 2004 Standard-date: 2004-09-15 21:56:38 GMT Modified-files: mod/wiki/wikifiles.php New-patches: arch-eduforge@catalyst.net.nz--2004/moodle--eduforge--1.3.3--patch-63 Summary: wikifiles integration with upload class - this is just the initial page part, not the upload a file into the wiki parg Keywords: --- mod/wiki/wikifiles.php | 33 ++++++++------------------------- 1 file changed, 8 insertions(+), 25 deletions(-) diff --git a/mod/wiki/wikifiles.php b/mod/wiki/wikifiles.php index fe45d214fc..bd8a4c31e0 100755 --- a/mod/wiki/wikifiles.php +++ b/mod/wiki/wikifiles.php @@ -112,32 +112,16 @@ case "upload": html_header($course, $wdir); - - if (!empty($_FILES['userfile'])) { - $userfile = $_FILES['userfile']; - } else { - $save = false; - } + require_once($CFG->dirroot.'/lib/uploadlib.php'); + if (!empty($save)) { - if (!is_uploaded_file($userfile['tmp_name']) or $userfile['size'] == 0) { - notify(get_string("uploadnofilefound")); - } else { - $userfile_name = clean_filename($userfile['name']); - if ($userfile_name) { - $newfile = "$basedir$wdir/$userfile_name"; - if (move_uploaded_file($userfile['tmp_name'], $newfile)) { - chmod($newfile, 0666); - $a = NULL; - $a->file = "$userfile_name (".$userfile['type'].")"; - $a->directory = $wdir; - print_string("uploadedfileto", "", $a); - } else { - notify(get_string("uploadproblem", "", $userfile_name)); - } - } + $um = new upload_manager('userfile',false,false,$course,false,0); + $dir = "$basedir$wdir"; + if ($um->process_file_uploads($dir)) { + notify(get_string('uploadedfile')); } + // um will take care of error reporting. displaydir($wdir); - } else { $upload_max_filesize = get_max_upload_file_size($CFG->maxbytes); $filesize = display_size($upload_max_filesize); @@ -150,11 +134,10 @@ echo "

$struploadafile ($strmaxsize) --> $wdir"; echo "
"; echo "
"; - echo " "; echo " "; echo " "; echo " "; - echo " "; + upload_print_form_fragment(1,array('userfile'),null,false,null,$course->maxbytes,0,false); echo "
"; echo " "; echo ""; -- 2.39.5