mirror of
https://github.com/moodle/moodle.git
synced 2025-08-05 00:46:50 +02:00
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 <penny@catalyst.net.nz> 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 <penny@catalyst.net.nz> 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:
This commit is contained in:
parent
5e7856af58
commit
16ffe14a93
1 changed files with 8 additions and 25 deletions
|
@ -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 "<P>$struploadafile ($strmaxsize) --> <B>$wdir</B>";
|
||||
echo "<TABLE><TR><TD COLSPAN=2>";
|
||||
echo "<FORM ENCTYPE=\"multipart/form-data\" METHOD=\"post\" ACTION=\"".$ME."\">";
|
||||
echo " <INPUT TYPE=hidden NAME=MAX_FILE_SIZE value=\"$upload_max_filesize\" />";
|
||||
echo " <INPUT TYPE=hidden NAME=id VALUE=$id />";
|
||||
echo " <INPUT TYPE=hidden NAME=wdir VALUE=$wdir />";
|
||||
echo " <INPUT TYPE=hidden NAME=action VALUE=upload />";
|
||||
echo " <INPUT NAME=\"userfile\" TYPE=\"file\" size=\"60\" />";
|
||||
upload_print_form_fragment(1,array('userfile'),null,false,null,$course->maxbytes,0,false);
|
||||
echo " </TD><TR><TD WIDTH=10>";
|
||||
echo " <INPUT TYPE=submit NAME=save VALUE=\"$struploadthisfile\" />";
|
||||
echo "</FORM>";
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue