500000 && $status['current']/$status['total'] < 0.9 ) { // Large file and we are < 90% complete
$status['interval'] = 3000;
} else if($status['total'] > 200000 && $status['current']/$status['total'] < 0.8 ) { // Is this a largeish file and we are < 80% complete
$status['interval'] = 2000;
} else {
$status['interval'] = 1000;
}
owupload_output($status);
} else {
$status = array();
$status['noprogress'] = true;
foreach($owupload_allowed_extensions as $e) {
if(file_exists(OWUPLOAD_PATH.'/'.$check.'.'.$e)) {
$ext = $e;
break;
}
}
if($ext) {
$status['url'] = owupload_file_uri($check.'.'.$ext);
}
owupload_output($status);
}
}
// Display error
function owupload_error($msg)
{
echo owupload_output(array('error' => $msg));
}
function owupload_output($status, $showLoadingMsg = false)
{
$script = '
try
{
'.(($_SERVER['REQUEST_METHOD']=='POST') ? 'top.' : '').'owUploadButton.statusCb('.json_encode($status).');
} catch(e) { alert(e.message); }
';
if($_SERVER['REQUEST_METHOD']=='POST')
{
echo '';
}
else
{
echo $script;
}
if($_SERVER['REQUEST_METHOD']=='POST' && $showLoadingMsg)
{
echo
<<
Upload en cours...