]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-15614 Add 3 missing PHP error codes to get_file_upload_error()
authorfmarier <fmarier>
Mon, 14 Jul 2008 02:38:50 +0000 (02:38 +0000)
committerfmarier <fmarier>
Mon, 14 Jul 2008 02:38:50 +0000 (02:38 +0000)
The get_file_upload_error() function was missing the following error codes:

    UPLOAD_ERR_NO_TMP_DIR => 'Missing a temporary folder.',
    UPLOAD_ERR_CANT_WRITE => 'Failed to write file to disk.',
    UPLOAD_ERR_EXTENSION => 'File upload stopped by extension.',

(see http://www.php.net/manual/en/features.file-upload.errors.php)

lang/en_utf8/moodle.php
lib/uploadlib.php

index 6d68c2ab085d044a0cfc01fc76a082bace87d685..88d13c7cc38cc86e29a279aa15b06d585c71c0d4 100644 (file)
@@ -1536,15 +1536,18 @@ $string['updatinga'] = 'Updating: $a';
 $string['updatingain'] = 'Updating $a->what in $a->in';
 $string['upload'] = 'Upload';
 $string['uploadafile'] = 'Upload a file';
+$string['uploadcantwrite'] = 'Failed to write file to disk';
 $string['uploadedfile'] = 'File uploaded successfully';
 $string['uploadedfileto'] = 'Uploaded $a->file to $a->directory';
 $string['uploadedfiletoobig'] = 'Sorry, but that file is too big (limit is $a bytes)';
+$string['uploadextension'] = 'File upload stopped by extension';
 $string['uploadfailednotrecovering'] = 'Your file upload has failed because there was a problem with one of the files, $a->name.<br /> Here is a log of the problems:<br />$a->problem<br />Not recovering.';
 $string['uploadfilelog'] = 'Upload log for file $a';
 $string['uploadformlimit'] = 'Uploaded file exceeded the maximum size limit set by the form';
 $string['uploadlabel'] = 'Title:';
 $string['uploadnofilefound'] = 'No file was found - are you sure you selected one to upload?';
 $string['uploadnotallowed'] = 'Uploads are not allowed';
+$string['uploadnotempdir'] = 'Missing a temporary folder';
 $string['uploadoldfilesdeleted'] = 'The old file(s) in your upload area have been deleted';
 $string['uploadpartialfile'] = 'File was only partially uploaded';
 $string['uploadproblem'] = 'An unknown problem occurred while uploading the file \'$a\' (perhaps it was too large?)';
index 61153b5b029b5073f9c943537b23542954c90c05..b902118b660137180d6bad653a15d2844d279c84 100644 (file)
@@ -392,6 +392,20 @@ class upload_manager {
             $errmessage = get_string('uploadnofilefound');
             break;
             
+        // Note: there is no error with a value of 5
+
+        case 6: // UPLOAD_ERR_NO_TMP_DIR
+            $errmessage = get_string('uploadnotempdir');
+            break;
+
+        case 7: // UPLOAD_ERR_CANT_WRITE
+            $errmessage = get_string('uploadcantwrite');
+            break;
+
+        case 8: // UPLOAD_ERR_EXTENSION
+            $errmessage = get_string('uploadextension');
+            break;
+
         default:
             $errmessage = get_string('uploadproblem', $file['name']);
         }