php - ajaxupload jeditable and zend framework -
i trying use jeditable ajaxupload, can see demo here. using plugin in zend view file follows:
js code
$(".ajaxupload").editable("<?php echo $this->baseurl('/inside/students/update-student'); ?>", { indicator : "<img src='<?php echo $this->baseurl('img/indicator.gif'); ?>'>", type : 'ajaxupload', submit : 'upload', cancel : 'cancel', tooltip : "click upload..." });
html code
<img class="left-floating-image=" src="<?php echo $this->baseurl($this->user['img_path']); ?>" /> <p id="img_path" class="ajaxupload">upload</p>
my php code in zend controller:
public function updatestudentaction() { $this->_helper->layout->disablelayout(); $this->_helper->viewrenderer->setnorender(); if ($this->_request->ispost()) { $params = $this->_request->getparams(); zend_debug::dump($params); $field = $params['id']; $value = $params['value']; // $userid = zend_auth::getinstance()->getidentity()->id; // // $usermodel = new application_model_users(); // $usermodel->update(array($field => $value), "id = $userid"); echo $value; } }
the problem when dump post vars don't posted variable. this:
array(3) { ["module"] => string(6) "inside" ["controller"] => string(8) "students" ["action"] => string(14) "update-student" }
and 2 errors saying there no index 'id' or 'value'. checked being sent server using tamper data plugin firefox. here output:
21:46:09.886[634ms][total 634ms] status: 200[ok] post http://localhost/industrial/public/inside/students/update-student load flags[load_document_uri load_initial_document_uri ] content size[540] mime type[text/html] request headers: host[localhost] user-agent[mozilla/5.0 (windows; u; windows nt 6.1; en-us; rv:1.9.2.12) gecko/20101026 firefox/3.6.12] accept[text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8] accept-language[en-us,en;q=0.5] accept-encoding[gzip,deflate] accept-charset[iso-8859-1,utf-8;q=0.7,*;q=0.7] keep-alive[115] connection[keep-alive] referer[http://localhost/industrial/public/inside/students] cookie[phpsessid=dufubvhd6bihqd4jk5q655bap3] post data: post_data[-----------------------------215452871217546 content-disposition: form-data; name="value"; filename="btn_companies.png" content-type: image/png png
how can file being sent if zend doesn't post_data? once solved need make method take decisions on type of data being submitted (text or files).
first of: http://teethgrinder.co.uk/perm.php?a=zend-framework-jeditable i'm still not quite sure learnt last week:
hi,
you can not read file input field jquery/javascript, due js security restrictions. if remember correctly read file input element return empty string.
the $form->isvalidpartial() method not perform validation request param mailattcht empty.
also can not perform file upload through ajax if ultimate intention.
kind regards
garry
Comments
Post a Comment