0

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

sonic
  • 1,282
  • 1
  • 9
  • 22

1 Answers1

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.

Itay Taragano
  • 1,901
  • 1
  • 11
  • 12
  • @hodiecode How did you achieve this direct delete from browser, cn you please paste detail here ? – sunil Oct 09 '14 at 07:25
  • @sunil First I need to get signature so I send post via ajax to my own controller where I can create signature and return it. Having all needed data I can send ajax to cloudinary servers. To build my signature I use something like this `signature = Digest::SHA1.hexdigest "public_id=#{image_id}&timestamp=#{timestamp}#{api_secret}"` docs: http://cloudinary.com/documentation/upload_images#deleting_images http://cloudinary.com/documentation/upload_images#request_authentication – sonic Oct 09 '14 at 17:18