function filefield_nginx_progress_ajax in FileField Nginx Progress 7
Same name and namespace in other branches
- 7.2 filefield_nginx_progress.module \filefield_nginx_progress_ajax()
Menu callback for nginx upload progress.
1 string reference to 'filefield_nginx_progress_ajax'
- filefield_nginx_progress_menu in ./
filefield_nginx_progress.module - Implementation of hook_menu().
File
- ./
filefield_nginx_progress.module, line 26 - Adds upload progress functionality to FileFields on the nginx webserver.
Code
function filefield_nginx_progress_ajax($key) {
$progress = array(
'message' => t('Starting upload...'),
'percentage' => -1,
);
$status = nginx_progress_fetch($key);
if ($status['state'] == 'uploading') {
$progress['message'] = t('Uploading... (@current of @total)', array(
'@current' => format_size($status['received']),
'@total' => format_size($status['size']),
));
$progress['percentage'] = round(100 * $status['received'] / $status['size']);
}
drupal_json_output($progress);
}