Minor - Using format_file_size() function + cosmetic changes

skala
Julio Montoya 13 years ago
parent 6e7b016de1
commit e6502101b7
  1. 2
      main/document/document_quota.php
  2. 4
      main/inc/lib/document.lib.php
  3. 6
      main/inc/lib/fileUpload.lib.php

@ -21,7 +21,7 @@ $htmlHeadXtra[] = api_get_css(api_get_path(WEB_LIBRARY_PATH).'javascript/jqplot/
$course_code = api_get_course_id();
$course_id = api_get_course_int_id();
$session_id = api_get_session_id();
$group_id = api_get_group_id();
$group_id = api_get_group_id();
$session = array();
$session_list = SessionManager::get_session_by_course($course_code);

@ -2191,11 +2191,11 @@ class DocumentManager {
if (isset($files['file'])) {
$upload_ok = process_uploaded_file($files['file'], $show_output);
if ($upload_ok) {
// File got on the server without problems, now process it
$new_path = handle_uploaded_document($course_info, $files['file'], $base_work_dir, $path, api_get_user_id(), api_get_group_id(), null, $max_filled_space, $unzip, $if_exists, $show_output);
if ($new_path) {
$docid = DocumentManager::get_document_id($course_info, $new_path);

@ -89,6 +89,7 @@ function get_document_title($name) {
*/
function process_uploaded_file($uploaded_file, $show_output = true) {
// Checking the error code sent with the file upload.
switch ($uploaded_file['error']) {
case 1:
// The uploaded file exceeds the upload_max_filesize directive in php.ini.
@ -100,7 +101,7 @@ function process_uploaded_file($uploaded_file, $show_output = true) {
// Not used at the moment, but could be handy if we want to limit the size of an upload (e.g. image upload in html editor).
$max_file_size = intval($_POST['MAX_FILE_SIZE']);
if ($show_output) {
Display::display_error_message(get_lang('UplExceedMaxPostSize'). round($max_file_size/1024) .' KB');
Display::display_error_message(get_lang('UplExceedMaxPostSize'). format_file_size($max_file_size));
}
return false;
case 3:
@ -123,7 +124,8 @@ function process_uploaded_file($uploaded_file, $show_output = true) {
Display::display_error_message(get_lang('UplUploadFailed'));
}
return false;
}
}
if (file_exists($uploaded_file['tmp_name'])) {
$filesize = filesize($uploaded_file['tmp_name']);
if (empty($filesize)) {

Loading…
Cancel
Save