This commit is contained in:
Fredrick Brennan 2017-11-03 22:12:35 +08:00
parent b7a3bde4c8
commit 8e811cec44
2 changed files with 8 additions and 0 deletions

View File

@ -1135,6 +1135,7 @@
$config['error']['toomanyreports'] = _('You can\'t report that many posts at once.');
$config['error']['invalidpassword'] = _('Wrong password…');
$config['error']['invalidimg'] = _('Invalid image.');
$config['error']['phpfileserror'] = _('Upload failure (file #%index%): Error code %code%. Refer to <a href="http://php.net/manual/en/features.file-upload.errors.php">http://php.net/manual/en/features.file-upload.errors.php</a>; post discarded.');
$config['error']['unknownext'] = _('Unknown file extension.');
$config['error']['filesize'] = _('Maximum file size: %maxsz% bytes<br>Your file\'s size: %filesz% bytes');
$config['error']['maxsize'] = _('The file was too big.');

View File

@ -655,6 +655,13 @@ if (isset($_POST['delete'])) {
if ($post['has_file']) {
$i = 0;
foreach ($_FILES as $key => $file) {
if ($file['error'] > 0) {
error(sprintf3($config['error']['phpfileserror'], array(
'index' => $i+1,
'code' => $file['error']
)));
}
if ($file['size'] && $file['tmp_name']) {
$file['filename'] = urldecode($file['name']);
$file['extension'] = strtolower(mb_substr($file['filename'], mb_strrpos($file['filename'], '.') + 1));