Php 为JS模板[blueimp/jQuery文件上传]添加价值的热门工具
我对jQuery文件上传(blueimp)有意见 上传文件时,我将文件数据插入数据库。在这之后,我可以得到最后一个insert id。问题是:如何将这个值从PHP传输到JavaScript模板 更清楚地说,我需要如下模板:Php 为JS模板[blueimp/jQuery文件上传]添加价值的热门工具,php,javascript,jquery,Php,Javascript,Jquery,我对jQuery文件上传(blueimp)有意见 上传文件时,我将文件数据插入数据库。在这之后,我可以得到最后一个insert id。问题是:如何将这个值从PHP传输到JavaScript模板 更清楚地说,我需要如下模板: <script id="template-download" type="text/x-tmpl"> {% for (var i=0, file; file=o.files[i]; i++) { %} <div class="templat
<script id="template-download" type="text/x-tmpl">
{% for (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>
然后我们可以在模板中使用
file.myvar
。我有一些额外的表单数据,我很幸运地将它们添加到函数handle\u file\u 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];
我有一些额外的表单数据,我很幸运地将它们添加到函数
handle\u file\u 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];