0
A
回答
0
INIT:函数(){ VAR myDropzone =此; $('#div_breakfast_img_org_name')。append(); $('#div_breakfast_img_file_name')。append(); $('#breakfast_sequence')。val('');
if ('<?php echo count($bfImageArrayData) ?>')
{
<?php foreach ($bfImageArrayData as $bfImage) { ?>
var mockFile = {name: '<?php echo $bfImage['image_name']; ?>', sfn: '<?php echo base64_encode('/diet_image/' . $bfImage['image']); ?>', };
var thumbUrl = '<?php echo url('/'); ?>/uploads/diet_image/<?php echo $bfImage['image']; ?>';
// Call the default addedfile event handler
myDropzone.emit("addedfile", mockFile);
// And optionally show the thumbnail of the file:
myDropzone.emit("thumbnail", mockFile, thumbUrl);
//myDropZone.uploadProgress(100);
myDropzone.files.push(mockFile);
$(mockFile.previewElement).prop('id', '<?php echo $bfImage['image']; ?>');
$('.dz-progress').remove();
//i++;
<?php } ?>
}
// removed file event
myDropzone.on('removedfile', function (file) {
var sfnValue = file.sfn;
var filePath = '';
$.each($(file.xhr), function (key, val) {
filePath = $.parseJSON(val['response']).newFilename;
});
var fileName = file.name;
// To get file path value
var s = 0;
var filePathArray = new Array();
$('input[name^="breakfast_img_file_name"]').each(function() {//alert($(this).val());
filePathArray[s] = $(this).val();
s++;
});
// To get file original Name
var t = 0;
var fileNameArray = new Array();
$('input[name^="breakfast_img_ori_name"]').each(function() {//alert($(this).val());
fileNameArray[t] = $(this).val();
t++;
});
$.ajax({
url: '/upload/remove-diet-image',
data: {sfn: file.sfn, id: '<?php echo $diet_subcategory_id_pk; ?>', type: 'diet-image', fileName: fileName, filePath: filePath, fileNameArray: fileNameArray, filePathArray: filePathArray, action: 'breakfast'},
}).done(function (result) {//console.log(result.filename);
result = $.parseJSON(result);
$('#div_breakfast_img_org_name').remove();
$('#div_breakfast_img_file_name').remove();
$('.box-footer').append('<div id="div_breakfast_img_org_name">' + result.filename + '</div>');
$('.box-footer').append('<div id="div_breakfast_img_file_name">' + result.filepath + '</div>');
});
});
},
+0
$(mockFile.previewElement).prop('id','<?php echo $ bfImage ['image'];?>'); –
+0
http://stackoverflow.com/questions/25050848/adding-image-id-to-each-image-in-preview-template-in-dropzone-js –
相关问题
- 1. 如何在asp.net中的onclick事件时添加属性
- 2. 如何在FullCalendar中为每个事件添加rel属性?
- 3. jQuery插件如何添加事件?
- 4. Dropzone将添加的行数添加到dropzone的文件数量?
- 5. Jquery keyup事件不适用于动态添加的id属性
- 6. 在Nutch中添加自定义插件的属性文件
- 7. Dropzone添加现有文件
- 8. 如何使用sbt和onejar插件添加log4J属性文件?
- 9. 将属性添加到基本事件
- 10. 如何在eclipse中添加属性文件的文件夹
- 11. 如何在委托事件中获取表单ID属性
- 12. 如何在Openfire插件中添加离线事件处理?
- 13. 添加id属性的Zend_Form_Decorator_Label
- 14. Dropzone JS在添加“错误事件”时抛出“undefined”
- 15. 带有文件的Init Dropzone不强加maxFiles的限制
- 16. 如何在“属性事件”中获得onclick“属性事件”返回值?
- 17. 如何在jquery中的click事件中添加点击事件?
- 18. 在fullcalendar中添加新事件时如何获取资源ID
- 19. 如何在C#中的XML文件中添加XML属性
- 20. 如何在.Net中的文件中添加自定义属性?
- 21. 如何使用'contenteditable'属性将按键事件添加到div
- 22. 如何更改或添加样式属性onClick事件
- 23. 如何事件属性添加到HTML标记使用javascript
- 24. 如何将属性页面添加到eclipse项目(RCP /插件)
- 25. Knockout Mapping插件 - 如何将属性添加到默认映射?
- 26. 如何在TAL(PHPTAL)中有条件地添加一个id属性?
- 27. 在ASP.NET/VB.NET中,如何在用户控件将实现的接口上声明属性/事件(如IsPostBack/Init)?
- 28. 在DataBound事件中将属性添加到DropDownList?
- 29. 每当在Javascript中添加对象属性时引发事件?
- 30. 如何将具有ID属性的doctype添加到java中的XML文件?
你可以分享你迄今为止试过的东西吗? – guradio