Want to upload multiple image file in a single post object

Hello,

I’m trying to create a basic social app where users can post their contents with text and images.

Like many blog post service, I’d like to allow users to upload multiple image files for a single post.

In a single post object, is there any way to create an array that contains multiple image files?
If not possible, could you tell me other ways to achieve that.
(for example: create a postImages class in which each object point to parent post object)

Thank you.

you need to make the postImage into an array of string instead, that’ll be more fitting where you upload the file to Moralis server or IPFS and have the link as the element of the array :raised_hands:

1 Like

Hi, were you able to solve this issue? Im currently having the same kind of issue. Please help me with a solution

You can upload a folder with multiple files to IPFS. Not sure if it helps.

What is the main problem that you have?

Thank you for your response. I have 3 input:file fields that i want to upload separately (not as multiple files). I have tried the example on the doc for a single file at a time and it works out fine but i’m stuck on how to upload 3 files using different IDs
Let me say that i am also new to JavaScript too.

you want to upload them to IPFS or to the database?

you may be able to do some kind of for/loop to iterate over them and upload them one at a time

I want to upload to database.

you can test with a cloud function to see if you can send all the images in the same request