Imam problem vezan za progres bar pri ajax uploadu fajlova.
Na test serveru sve radi kako treba, dok isti kod prebacen na live server ne radi, tacnije vraca false.
HTML
Kôd:
<form target="hiddenframe" enctype="multipart/form-data" name="form1" id="uploadform" style="margin-left:6px;" action="" method="POST">
<input type="hidden" name="APC_UPLOAD_PROGRESS" id="progress_key" value="{$upl_id}" />
<input type="file" id="numlist" size="25" name="filefieldname" {literal}onchange="fandl_simple_sms(this.id,Array('numbers','choiceG','numlist'));"{/literal}/>
</form>
<input type="hidden" id="filename" value=""/>
<iframe name="hiddenframe" style="display:none" >Loading...</iframe>
Javascript
Kôd:
var params = { upl_id: upl_id };
new Ajax.Request(
'/cust/klase/upload_progress.php',
{
'parameters': params,
onSuccess: function(transport)
{
var resp = transport.responseText;
var odgovor;
eval('odgovor = ' + resp);
if(odgovor.status == "OK")
{
$('uploadedfile').update("Uploaded "+odgovor.trenutno+"kb from "+odgovor.total+"kb");
if(odgovor.procenat!=100)
setTimeout("waitUpload('"+upl_id+"')",300);
}
else if (odgovor.status == 'LARGE')
{
$('uploadedfile').update(odgovor.message);
return;
}
}
}
);
PHP skripta koja obradjuje velicinu obradjenog dela fajla
Kôd:
if(isset($_REQUEST['upl_id']))
{
$status = apc_fetch('upload_'.$_REQUEST['upl_id']);
if($status['total']>10000000)
{
echo json_encode(Array('status' => 'LARGE','message' => 'File is larger then 10 MB'));
return;
}
$procenat=round($status['current']/$status['total']*100);
echo json_encode(Array('status' => 'OK','procenat' => $procenat, 'total' => round($status['total']/1000), 'trenutno' => round($status['current']/1000)));
}
E sad problem je sto to sve na development serveru radi kako treba, dok na live serveru apc_fetch vraca false ili nista.
Da li je neko imao ranije neko iskustvo sa APC kesiranjem i progres barom za upload fajlova.
Hvala unapred.