I have a functionality where I need the user to upload multiple files/images. The length of the requested files can be dynamic.
def add_images(image1: UploadFile = File(...),image2: UploadFile = File(...),image3: UploadFile = File(...)):
return {"msg": "success"}
As of now, This is the body that I was requesting but I know this is not the ideal way.
CodePudding user response:
You can upload multiple images by requesting the images as a List of UploadFile.
from typing import List
def add_images(images: List[UploadFile] = File(...)):
// Your image upload code here
return {"msg": "success"}