jquery - BlueImp fileuploadsubmit serializeArray() sends 1 character response -
with successful upload blueimp fileupload plugin, forms other data submitted well, however, json data response i'm receiving firebug shows response each input field truncated 1 character (byte?). expected response? using jquerymobile , blueimp fileupload plugin. please see specifics:
var formdata = $('#uploadform'); console.log( formdata.serializearray() );
result console.log
[object { name="image_name", value="don"}, object { name="image_description", value="testing"}, object { name="image_keywords", value="musician actor artists"}, object { name="image_nudity", value="0"}, object { name="cat_id", value="42"}, object { name="action", value="uploadimage"}]
post response blueimp fileuploadsubmit
{"files":[{"name":"image2.jpeg","size":114688,"type":"image/jpeg","cat_id":"4","image_name":"d","image_nudity":"","image_description":"t","image_keywords":"m","action":"u","example":"","user_id":"2","url":"../models/data/tmp_media/image2.jpeg","thumbnailurl":"../models/data/tmp_media/thumbnail/image2.jpeg","deleteurl":"http://myfame/mobile/?file=image2.jpeg","deletetype":"delete"}]}
here's code uploadhandler.php
protected function handle_form_data($file, $index) { global $user_info; $file->cat_id = (empty($_request['cat_id'][$index])) ? "" : $_request['cat_id'][$index]; $file->image_name = (empty($_request['image_name'][$index])) ? "" : $_request['image_name'][$index]; $file->image_nudity = (empty($_request['image_nudity'][$index])) ? "" : $_request['image_nudity'][$index]; $file->image_description = (empty($_request['image_description'][$index])) ? "" : $_request['image_description'][$index]; $file->image_keywords = (empty($_request['image_keywords'][$index])) ? "" : $_request['image_keywords'][$index]; $file->action = (empty($_request['action'][$index])) ? "" : $_request['action'][$index]; $file->example = (empty($_request['example'][$index])) ? "" : $_request['example'][$index]; $file->user_id = $user_info['user_id'];
note discrepancy of submitted data , response truncating inputs 1 character, ideas on how can fixed, or bug?
solved - change $_request $_post or $_get depending on chose option , modify function handle_form_data($file, $index) selected option. best check if variables empty throw error if not set.
doing solved particular problem.
Comments
Post a Comment