filestack / filestack-rails

Official Ruby on Rails plugin for Filestack File Picker that makes it easy to add powerful file uploading and transformation capabilities to any web or mobile application.
https://www.filestack.com
Apache License 2.0
223 stars 101 forks source link

multiple upload support #229

Closed zachlevy closed 3 years ago

zachlevy commented 4 years ago

How can I upload multiple photos?

I'm using the maxFiles option which allows me to upload multiple files to filestack servers.

<%= form.filestack_field :photos, 'Upload',  pickerOptions: { accept: ["image/*"], maxFiles: 6 } %>

I'm expecting uploading 2 photos to give me a url to grab both photos from.

<input id="mymodel_photos" style="display:none" type="text" name="mymodel[photos]">
$('#mymodel_photos').val();

returns a just the first file url like https://cdn.filestackcontent.com/IjTo4OxQvi7dwepWfjCH

inspecting params doesn't show any other fields.

<ActionController::Parameters {
  "mymodel"=>{
    "photos"=>"https://cdn.filestackcontent.com/IjTo4OxQvi7dwepWfjCH",
  }, "commit"=>"Create Mymodel",
} permitted: false>
gabifija commented 3 years ago

@zachlevy Sorry for the delay. I've updated the library (5.4.0) and I've added a support for uploading multiple files. Now, you are able to grab all urls of uploaded files. Let me know if that works for you as you expected. If you need anything else, ping me.