netlify-cmsuploadcare

NetlifyCMS Unable to select multiple images using Uploadcare "image" widget


Here is the relevant portion of my config.yml for NetlifyCMS where I want to use Uploadcare's image widget to select multiple images for a gallery:

media_library:
  name: uploadcare
  config:
    publickey: mypublicapikey
media_folder: "/src/images/"
public_folder: "/src/images/"
collections:
  - label: "Projects" 
    name: "projects" 
    folder: "src/data/projects" 
    media_folder: 'images' 
    media_library:
      name: uploadcare
      config:
        publickey: mypublicapikey
    fields: # The fields for each document, usually in front matter
      - {label: "Image", name: "image", widget: "image", allow_multiple: false}
      - label: "Gallery Images"
        name: "images"
        widget: "image"
        options:
          media_library:
            config:
              multiple: true
              previewStep: false

This results in a widget where I can only select one image. I have tried shift/ctrl/ctrl+shift clicking additional entries but it doesn't work. The docs say allowing for multiple images is the default, but this is not the behavior I am experiencing.


Solution

  • To get Uploadcare working, you may need to install the uploadcare plugin for netlify-cms:

    npm i netlify-cms-media-library-uploadcare --save
    

    I followed the solution posted here, to break it down:

    1. Create a cms folder in src
    2. Add a cms.js file to the src/cms folder
    3. Add this code:
    import CMS from 'netlify-cms-app'
    import uploadcare from 'netlify-cms-media-library-uploadcare';
    
    CMS.registerMediaLibrary(uploadcare);
    

    Then follow the docs for Uploadcare.