I am just setting up another instance of payload for a image-based dataset i wanna host. When just uploading my ~150 images into my media folder (which i have mounted inside my Media Collection) - they are not detected as media instances. Is there a nice way for such batch uploads, or do i really need to upload all images 1by1 to get them as Items inside the collection?
As of now you cannot batch upload. You could write your own script that uses the Local API to create the media collection items one by one.
Bulk uploading is part of the roadmap, stay tuned because it is an often asked for feature 🙂
Is this something I can expect in the next week's?
Hey Joekr - we like to keep our launch week items under wraps until the week of, so you'll just have to stay tuned until then. Just know that Bulk operations are pretty high up on our list, so it shouldn't be too long now!
I need this as well!
I just wanna chime in and say I need this as well haha
Until this feature is available, you can use the local API to upload files in bulk
This assumes you have an express route that accepts multiple files
But then you would follow the pattern of
const media = await payload.create<Media>({
collection: 'media',
data: {
alt: `alt text`,
},
file: <file buffer>,
})
In an array
Once all of the promises have resolved, then you can set each uploaded item to a collection item
Which is a payload.update call on whichever collection needs the uploaded file
Star
Discord
online
Get dedicated engineering support directly from the Payload team.