Cloudinary - direct delete , jquery file upload, hidden fields

喜欢而已 提交于 2019-12-13 05:06:37

问题


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">

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.

cloudinary documentation - Direct upload file tag


回答1:


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.



来源:https://stackoverflow.com/questions/24661949/cloudinary-direct-delete-jquery-file-upload-hidden-fields

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!