function nginx_progress_fetch in FileField Nginx Progress 7.2
Same name and namespace in other branches
- 6 filefield_nginx_progress.module \nginx_progress_fetch()
- 7 filefield_nginx_progress.module \nginx_progress_fetch()
Fetch the upload progress from nginx using the X-Progress-ID header.
Parameters
integer $key: The key generated when processing the upload button element.
Return value
array An array with the status information for the progress bar.
1 call to nginx_progress_fetch()
- filefield_nginx_progress_ajax in ./
filefield_nginx_progress.module - Menu callback for nginx upload progress.
File
- ./
filefield_nginx_progress.module, line 124 - filefield_nginx_progress.module @author Ben Osman <dev@smoothify.com> António P. P. Almeida <appa@perusio.net> @date Sun Oct 21 14:31:03 2012
Code
function nginx_progress_fetch($key) {
global $base_url;
$url = url("{$base_url}/progress", array(
'absolute' => TRUE,
'external' => TRUE,
));
// We get the response using an header instead of a query string. This
// mimics what is given as example on the module README.
$response = drupal_http_request($url, array(
'headers' => array(
'X-Progress-ID' => $key,
),
));
// Decode the JSON response.
return drupal_json_decode($response->data);
}