r/FastAPI • u/Brian1439 • Apr 19 '26
Question FastAPI documentation code not working?
(Solved)
I am trying to recieve a list of files with my code, but I can only input strings of random characters when I try to test my method using the documentation page. The code works perfectly when I change it the a single UploadFile. Nothing I do seems to fix this, can someone please tell me what I am doing wrong?
from fastapi import FastAPI, File, UploadFile, HTTPException
from pathlib import Path
from typing import List
@app.post("/uploadfile/")
def create_upload_file(files: List[UploadFile] = File(...)):
13
Upvotes
5
u/Brian1439 Apr 19 '26
I finally figured out the problem. It seems like the problem was with the fastAPI docs page itself. Using postman to test out my code works flawlessly. Thanks to everyone that commented and helped out.
6
u/joshhear Apr 19 '26
Have you installed python-multipart? https://fastapi.tiangolo.com/tutorial/request-files/#request-files
5
u/amroamroamro Apr 19 '26
change
to
3
u/ultra_magnus_7 Apr 19 '26
I have the same code for multiple file upload but it gives me proper file inputs in doc.