php - Hot to add value to the JS template [blueimp / jQuery-File-Upload] -


i've got issue jquery file upload (blueimp).

on uploading files insert file data db. right after can last insert id. issue: how can transmit value php javascript template?

to more clear, need template like:

<script id="template-download" type="text/x-tmpl"> {% (var i=0, file; file=o.files[i]; i++) { %} <div class="template-download fade" id="file-{%=file.id%}"> <div class="name"><span>{%=file.name%}</span></div> .... </div> {% } %} </script> 

where file.id last insert id defined in php.

solutuon: function post in class uploadhandler. add

$info[$index]->myvar= 'something'; 

then can use file.myvar in template.

i had form data, , had luck adding them function handle_file_upload

$file = new stdclass(); $file->name = $this->trim_file_name($name, $type, $index); $file->size = $this->fix_integer_overflow(intval($size)); $file->type = $type; //add additional post variables here: $file->title = $_post['title'][$index]; $file->description = $_post['description'][$index]; 

Comments

Popular posts from this blog

javascript - backbone.js Collection.add() doesn't `construct` (`initialize`) an object -

php - Get uncommon values from two or more arrays -

Adding duplicate array rows in Php -