How to upload and get URLs for multiple images in Sanity, and add captions to individual images.

10 replies
Last updated: Jan 28, 2026
Hello guys , i am new to sanity and i have a 2 little problems .. first one is i did this schema to upload multiple images but i can't figure out how to get their url.. this is the schema for multi images upload
{
      
name: 'ProjectImages',
      
title: 'Project Images',
      
type: 'array',
      
of: [{ type: 'image' }]
     
},
and this is how i tried to get the url in my react frontend

ProjectImages{
        
asset->{
       
_id,
       
url
      
}
     
}

my second problem is how to enable multi-select for image upload because i keep uploading image by image
please help me i will appreciate it so much
AI Update

Great questions! Let me help you with both issues.

Problem 1: Getting Image URLs from an Array

Your GROQ query is almost correct, but you need to account for the array structure. Since ProjectImages is an array, you need to query each item in the array:

ProjectImages[]{
  asset->{
    _id,
    url
  }
}

The key difference is adding [] after ProjectImages - this tells GROQ to iterate over the array and get the asset reference for each image.

This will return an array of objects like:

[
  {
    "asset": {
      "_id": "image-abc123...",
      "url": "https://cdn.sanity.io/images/..."
    }
  },
  {
    "asset": {
      "_id": "image-def456...",
      "url": "https://cdn.sanity.io/images/..."
    }
  }
]

If you want just the URLs in a flatter structure, you can use:

"projectImages": ProjectImages[].asset->url

This will give you a simple array of URL strings.

Problem 2: Multi-Select Image Upload

Unfortunately, Sanity Studio doesn't currently support native multi-select for image uploads in array fields. You have to upload images one at a time by default.

However, you can drag and drop multiple images at once! Instead of clicking the upload button repeatedly:

  1. Select multiple image files from your file explorer
  2. Drag them all together onto the image array field in Studio
  3. Sanity will process and add them all sequentially

This is much faster than clicking upload for each individual image. The drag-and-drop functionality works in modern versions of Sanity Studio (v3 and later) and is the recommended approach for bulk image uploads.

For more advanced multi-select functionality, you'd need to create a custom input component using Sanity's custom input widgets, but the drag-and-drop approach should solve your workflow issue without any custom code.

Hope this helps! Let me know if you run into any issues with these solutions.

Show original thread
10 replies

Sanity – Build the way you think, not the way your CMS thinks

Sanity is the developer-first content operating system that gives you complete control. Schema-as-code, GROQ queries, and real-time APIs mean no more workarounds or waiting for deployments. Free to start, scale as you grow.

Was this answer helpful?