php - Yii framework and file upload progress -


i googled , saw there plugins this. not want use plugin because problem this. through yii possible in session variable obtain data regarding progress of uploading file?i'm making system uses php , yii framework. i'm building module upload files. working except display of progress bar.

i researched , found version of php 5.4 has capability forward: session upload progress (http://php.net/manual/en/session.upload-progress.php)

i enabled setting in php.ini. using file upload plugin assist in client side perform file uploads. (github.com/blueimp/jquery-file-upload)

i want run following code:

client side:

$('#fileupload').bind('fileuploadsend', function(e, data) {             // feature useful browsers rely on iframe transport:             if (data.datatype.substr(0, 6) === 'iframe') {                 // set php's session.upload_progress.name value:                 var progressobj = {                     name : 'php_session_upload_progress',                     value : (new date()).gettime()                 // pseudo unique id                 };                 data.formdata.push(progressobj);                 // start progress polling:                 data.context.data('interval', setinterval(function() {                     $.get(yii.baseurl + '/atl/default/progressupload', $.param([progressobj]), function(result) {                         // trigger fileupload progress event,                         // using result progress data:                         e = $.event('progress', {                             bubbles : false,                             cancelable : true                         });                         $.extend(e, result);                         ($('#fileupload').data('blueimp-fileupload') || $('#fileupload').data('fileupload'))._onprogress(e, data);                     }, 'json');                 }, 1000)); // poll every second             }         }).bind('fileuploadalways', function(e, data) {             clearinterval(data.context.data('interval'));         });          $('#fileupload').fileupload({             datatype : 'json',             axfilesize : 500000000,             forceiframetransport : true,             add : function(e, data) {                 data.context = $('<button/>').text('upload').appendto(document.body).click(function() {                     data.context = $('<p/>').text('uploading...').replaceall($(this));                     data.submit();                 });             },             done : function(e, data) {                 alert("done!");             },             progressall : function(e, data) {                 var progress = parseint(data.loaded / data.total * 100, 10);                 console.log(e, data, progress);                 $('#progress .bar').css('width', progress + '%');             }         }); 

server side:

public function actionprogressupload($php_session_upload_progress) {          $s = yii::app()->session['upload_progress_'.intval($php_session_upload_progress)];         $progress = array(                 'lengthcomputable' => true,                 'loaded' => $s['bytes_processed'],                 'total' => $s['content_length']         );         echo json_encode($progress);     } 

my problem:

yii in $ _session variable returns null, variable yii::app()->session not return me values ​​for upload progress.

i googled , saw there plugins this. not want use plugin because problem this. through yii possible in session variable obtain data regarding progress of uploading file?

thanks.

protected/config/main.php

check whether session set false in main config. if wont work

'session' => array ( 'autostart' => false, ),


Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -