From: mjollnir_ Date: Wed, 15 Sep 2004 22:42:10 +0000 (+0000) Subject: Integration of new centralised upload code with admin/uploaduser.php and fix in uploa... X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=46c5446e34a59150e7a3ddd965ae219be28bd1f0;p=moodle.git Integration of new centralised upload code with admin/uploaduser.php and fix in upload class so preprocess_files returns false if there are no files! 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-65 2004-09-15 22:31:09 GMT Penny Leach upload class now returns false in proprocess_files if there are no files (duh), + admin/uploaduser using upload class Full logs: Revision: moodle--eduforge--1.3.3--patch-65 Archive: arch-eduforge@catalyst.net.nz--2004 Creator: Penny Leach Date: Thu Sep 16 10:31:09 NZST 2004 Standard-date: 2004-09-15 22:31:09 GMT Modified-files: admin/uploaduser.php lib/uploadlib.php New-patches: arch-eduforge@catalyst.net.nz--2004/moodle--eduforge--1.3.3--patch-65 Summary: upload class now returns false in proprocess_files if there are no files (duh), + admin/uploaduser using upload class Keywords --- diff --git a/admin/uploaduser.php b/admin/uploaduser.php index 6817b73158..28a4a31e65 100755 --- a/admin/uploaduser.php +++ b/admin/uploaduser.php @@ -52,7 +52,11 @@ /// If a file has been uploaded, then process it - if ($filename = valid_uploaded_file($_FILES['userfile'])) { + + require_once($CFG->dirroot.'/lib/uploadlib.php'); + $um = new upload_manager('userfile',false,false,null,false,0); + if ($um->preprocess_files()) { + $filename = $um->files['userfile']['tmp_name']; //Fix mac/dos newlines $text = my_file_get_contents($filename); diff --git a/lib/uploadlib.php b/lib/uploadlib.php index 676f854632..05fab58a9d 100644 --- a/lib/uploadlib.php +++ b/lib/uploadlib.php @@ -80,6 +80,9 @@ class upload_manager { } } } + if (!is_array($_FILES) || count($_FILES) == 0) { + return false; + } $this->status = true; return true; // if we've got this far it means that we're recovering so we want status to be ok. }