Cloudinary-直接删除,jquery文件上传,隐藏字段 [英] Cloudinary - direct delete , jquery file upload, hidden fields

查看:132
本文介绍了Cloudinary-直接删除,jquery文件上传,隐藏字段的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用jquery文件上传+ cloudinary从浏览器直接上传了多个图片,并且我还需要直接删除上传的图片.我使用此文件标签

I did multiple image upload direct from browser using jquery file upload + cloudinary and I need to build direct delete of uploaded image also. I upload image using this file tag

<input name="file" type="file"
 class="cloudinary-fileupload"
 data-cloudinary-field="image_id[]" 
 data-form-data=" ... html-escaped JSON data ... "
 multiple="multiple >
</input>

上传后,它会创建这样的隐藏字段

after uploading, it creates hidden field like this

<input type="hidden" name="images_id[]"
value="image/upload/v1404930923/image_name">

我想做的是每次上传图像时都在此隐藏字段上添加其他属性,例如"data-id".直接从浏览器从Cloudinary删除文件时,我需要删除适当的隐藏字段.

What I want to do is to make additional attribute on this hidden field every time I upload an image, for example "data-id". I need to delete proper hidden field when I delete file from Cloudinary direct from the browser.

云文档-直接上传文件标签

推荐答案

由于隐藏字段具有一个值,例如:resource_type/type/path#signature,每个值在cloudinarydone处理程序的结果对象上都可用,因此您可以重构此值并遍历隐藏的字段并找到匹配的值,然后添加所需的属性.

Since the hidden field has a value, like: resource_type/type/path#signature, where each is available on the result object of the cloudinarydone handler, you can reconstruct this and traverse the hidden fields and find a matching value, and then add the attribute that you want.

这篇关于Cloudinary-直接删除,jquery文件上传,隐藏字段的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆