function _file_validate_size in Album Photos 7.3
Same name and namespace in other branches
- 6.2 photos_swfu/photos_swfu.module \_file_validate_size()
Copy file_validate_size.
File
- photos_swfu/
photos_swfu.module, line 296
Code
function _file_validate_size($file, $file_limit = 0, $user_limit = 0, $ac = FALSE) {
if (!$ac) {
$ac = $GLOBALS['user'];
}
$errors = array();
if ($ac->uid != 1) {
if ($file_limit && $file->filesize > $file_limit) {
$errors[] = t('The file is %filesize exceeding the maximum file size of %maxsize.', array(
'%filesize' => format_size($file->filesize),
'%maxsize' => format_size($file_limit),
));
}
$total_size = file_space_used($ac->uid) + $file->filesize;
if ($user_limit && $total_size > $user_limit) {
$errors[] = t('The file is %filesize which would exceed your disk quota of %quota.', array(
'%filesize' => format_size($file->filesize),
'%quota' => format_size($user_limit),
));
}
}
return $errors;
}