Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to upload multiple images to sanity.io?

I am searching for a way to uploading multiple images to sanity.io. Only thing that I found is this issue.

But maybe there is another way. Some npm-plugin or node.js app approach.

I'll be grateful for the help.

like image 760
Daria Moreno-Gogoleva Avatar asked Mar 24 '20 14:03

Daria Moreno-Gogoleva


People also ask

What is sanity client?

Sanity Client requires the JavaScript runtime to have a global ES6-compliant Promise available. If your runtime environment doesn't provide a spec compliant Promise implementation, we recommend using native-promise-only, es6-promise or another spec-compliant implementation.


1 Answers

I found the answer in sanity.io slack. This is it.

For multiple images upload you have to use array of images instead of field with 'image' type

{
 name: 'imagesGallery',
 title: 'Images gallery',
 type: 'array',
 of: [{ type: 'image' }]
}

This is simple and elegant way to solve my problem. Excellent!

like image 171
Daria Moreno-Gogoleva Avatar answered Sep 19 '22 00:09

Daria Moreno-Gogoleva