PHP APC and Pecl upload progress returning false/null.
Posted
by Keyo
on Stack Overflow
See other posts from Stack Overflow
or by Keyo
Published on 2010-05-28T04:03:07Z
Indexed on
2010/05/28
4:11 UTC
Read the original article
Hit count: 408
php
|codeigniter
This is a long shot. I believe this might be suhosin patch issue.
Here is my php from codeigniter:
public function uploadprogress($id) {
if ($id) {
header("Cache-Control: no-cache, must-revalidate");
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
echo json_encode(apc_fetch('upload_'.$id));
exit();
}
}
public function uploader() {
$this->load->view('myid/' . $this->router->class . '_uploader');
//phpinfo();
}
script:
<script type="text/javascript">
$(document).ready(function(){
var progress_key = $('#progress_key').val();
// this sets up the progress bar
$('#uploadform').submit(function() {
setTimeout(beginUpload,1500);
return;
});
function beginUpload() {
$("#progressbar").progressbar({ value:0}).fadeIn();
var i = setInterval(function() {
$.getJSON("/myid/videos/uploadprogress/" + progress_key, function(data) {
alert('data');
if (data == null) {
clearInterval(i);
location.reload(true);
return;
}
var response;
eval ("response = " + data);
if (!response)
return;
var percentage = Math.floor(100 * parseInt(response['bytes_uploaded']) / parseInt(response['bytes_total']));
$("#progressbar").progressbar({value:percentage});
}, 1500);
});
}
});
</script>
Has anyone had strange troubles with this before? The upload key is the same on the view and the uploadprogress method. I've Tried apc and pecl upload-progress both return false or null. I wondering if it's just suhosin patch messing up everything?
© Stack Overflow or respective owner