我在一个网页上设置了一个plupload脚本,当你上传文件时,它们被保存到正确的目录,但是当你提交包含上传者的表单时,它会将POST变量传递给一个简单的转储脚本。
此脚本的输出为:
uploader_0_tmpname p180vem99v11u6e517hcqolbj14.jpg
uploader_0_name Test1.jpg
uploader_0_status done
uploader_1_tmpname p180vfjm2p12uoumicd71qica544.jpg
uploader_1_name Test2.jpg
uploader_1_status done
是否可以将数据作为UploadedImages
之类的数组传递,然后数据可以如下所示?
array(
"0" => "p180vem99v11u6e517hcqolbj14.jpg",
"1" => "p180vfjm2p12uoumicd71qica544.jpg",
)
如果没有,是否可以创建一个php脚本来将这些变量转换为可用的数组?
答案 0 :(得分:0)
在jquery.plupload.queue.js文件中,搜索并编辑以下行:
l+='<input type="hidden" name="'+k+"_"+n+'_tmpname" value="'+plupload.xmlEncode(o.target_name)+'" />'
到
l+='<input type="hidden" name="'+k+"["+n+'][tmpname]" value="'+plupload.xmlEncode(o.target_name)+'" />'
现在:
l+='<input type="hidden" name="'+k+"_"+n+'_name" value="'+plupload.xmlEncode(o.name)+'" />'
到
l+='<input type="hidden" name="'+k+"["+n+'][name]" value="'+plupload.xmlEncode(o.name)+'" />'
最后:
l+='<input type="hidden" name="'+k+"_"+n+'_status" value="'+(o.status==plupload.DONE?"done":"failed")+'" />'
到
l+='<input type="hidden" name="'+k+"["+n+'][status]" value="'+(o.status==plupload.DONE?"done":"failed")+'" />'