Project

General

Profile

« Previous | Next » 

Revision 2044

Added by Dietmar over 10 years ago

  1. /admin/modules/install.php:: fixed Fileupload error messages

View differences:

install.php
19 19
error_reporting(E_ALL ^ E_NOTICE ^ E_WARNING);
20 20

  
21 21
// Setup admin object
22
require('../../config.php');
23
require_once(WB_PATH.'/framework/class.admin.php');
22
//require('../../config.php');
23
$config_file = realpath('../../config.php');
24
if(file_exists($config_file) && !defined('WB_URL'))
25
{
26
	require($config_file);
27
}
28

  
29
//require_once(WB_PATH.'/framework/class.admin.php');
24 30
$admin = new admin('Addons', 'modules_install', false);
25 31
if( !$admin->checkFTAN() )
26 32
{
......
51 57
		$admin->print_error($MESSAGE['GENERIC_BAD_PERMISSIONS']);
52 58
	}
53 59
} else {
60
    $iErrorMessage = ( isset($_FILES['userfile']['error']) && ( $_FILES['userfile']['error'] > 0 ) ? $_FILES['userfile']['error'] : UNKNOW_UPLOAD_ERROR );
54 61
// index for language files
55 62
	$key = 'UNKNOW_UPLOAD_ERROR';
56
    switch ($error_code) {
63
    switch ( $iErrorMessage ) {
57 64
        case UPLOAD_ERR_INI_SIZE:
58 65
            $key = 'UPLOAD_ERR_INI_SIZE';
66
            break;
59 67
        case UPLOAD_ERR_FORM_SIZE:
60 68
            $key = 'UPLOAD_ERR_FORM_SIZE';
69
            break;
61 70
        case UPLOAD_ERR_PARTIAL:
62 71
            $key = 'UPLOAD_ERR_PARTIAL';
72
            break;
63 73
        case UPLOAD_ERR_NO_FILE:
64 74
            $key = 'UPLOAD_ERR_NO_FILE';
65
        case UPLOAD_ERR_NO_TMP_DIR:
75
             break;
76
       case UPLOAD_ERR_NO_TMP_DIR:
66 77
            $key = 'UPLOAD_ERR_NO_TMP_DIR';
78
            break;
67 79
        case UPLOAD_ERR_CANT_WRITE:
68 80
            $key = 'UPLOAD_ERR_CANT_WRITE';
81
            break;
69 82
        case UPLOAD_ERR_EXTENSION:
70 83
            $key = 'UPLOAD_ERR_EXTENSION';
84
            break;
71 85
        default:
72 86
            $key = 'UNKNOW_UPLOAD_ERROR';
73 87
    }
88

  
74 89
	$admin->print_error($MESSAGE[$key].'<br />'.$MESSAGE['GENERIC_CANNOT_UPLOAD']);
75 90
}
76 91

  

Also available in: Unified diff