- Sort Score
- Result 10 results
- Languages All
Results 1 - 10 of 72 for uploadFile (0.06 sec)
-
docs/en/docs/reference/uploadfile.md
# `UploadFile` class You can define *path operation function* parameters to be of the type `UploadFile` to receive files from the request. You can import it directly from `fastapi`: ```python from fastapi import UploadFile ``` ::: fastapi.UploadFile options: members: - file - filename - size - headers - content_type - read
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Thu Apr 18 19:53:19 UTC 2024 - 472 bytes - Viewed (0) -
docs_src/request_files/tutorial001_03_an.py
from fastapi import FastAPI, File, UploadFile from typing_extensions import Annotated app = FastAPI() @app.post("/files/") async def create_file(file: Annotated[bytes, File(description="A file read as bytes")]): return {"file_size": len(file)} @app.post("/uploadfile/") async def create_upload_file( file: Annotated[UploadFile, File(description="A file read as UploadFile")], ):
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Sat Mar 18 12:29:59 UTC 2023 - 431 bytes - Viewed (0) -
docs_src/request_files/tutorial002.py
from typing import List from fastapi import FastAPI, File, UploadFile from fastapi.responses import HTMLResponse app = FastAPI() @app.post("/files/") async def create_files(files: List[bytes] = File()): return {"file_sizes": [len(file) for file in files]} @app.post("/uploadfiles/") async def create_upload_files(files: List[UploadFile]): return {"filenames": [file.filename for file in files]} @app.get("/")
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Fri May 13 23:38:22 UTC 2022 - 811 bytes - Viewed (0) -
docs_src/request_files/tutorial002_an_py39.py
from typing import Annotated from fastapi import FastAPI, File, UploadFile from fastapi.responses import HTMLResponse app = FastAPI() @app.post("/files/") async def create_files(files: Annotated[list[bytes], File()]): return {"file_sizes": [len(file) for file in files]} @app.post("/uploadfiles/") async def create_upload_files(files: list[UploadFile]): return {"filenames": [file.filename for file in files]}
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Sat Mar 18 12:29:59 UTC 2023 - 826 bytes - Viewed (0) -
docs_src/request_files/tutorial001_an_py39.py
from typing import Annotated from fastapi import FastAPI, File, UploadFile app = FastAPI() @app.post("/files/") async def create_file(file: Annotated[bytes, File()]): return {"file_size": len(file)} @app.post("/uploadfile/") async def create_upload_file(file: UploadFile):
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Sat Mar 18 12:29:59 UTC 2023 - 322 bytes - Viewed (0) -
docs/pt/docs/tutorial/request-files.md
Mas há muitos casos em que você pode se beneficiar do uso de `UploadFile`. ## Parâmetros de Arquivo com `UploadFile` Defina um parâmetro de arquivo com um tipo de `UploadFile`: {* ../../docs_src/request_files/tutorial001_an_py39.py hl[14] *} Utilizar `UploadFile` tem várias vantagens sobre `bytes`: * Você não precisa utilizar o `File()` no valor padrão do parâmetro.
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Wed Oct 30 19:52:32 UTC 2024 - 7.8K bytes - Viewed (0) -
tests/test_tutorial/test_request_files/test_tutorial001_02_an.py
response = client.post("/files/") assert response.status_code == 200, response.text assert response.json() == {"message": "No file sent"} def test_post_uploadfile_no_body(): response = client.post("/uploadfile/") assert response.status_code == 200, response.text assert response.json() == {"message": "No upload file sent"} def test_post_file(tmp_path): path = tmp_path / "test.txt"
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Fri Jul 07 17:12:13 UTC 2023 - 8.2K bytes - Viewed (0) -
docs/en/docs/tutorial/request-files.md
But there are several cases in which you might benefit from using `UploadFile`. ## File Parameters with `UploadFile` Define a file parameter with a type of `UploadFile`: //// tab | Python 3.9+ ```Python hl_lines="14" {!> ../../docs_src/request_files/tutorial001_an_py39.py!} ``` ////
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Sun Oct 06 20:36:54 UTC 2024 - 10.2K bytes - Viewed (0) -
docs_src/request_files/tutorial003_py39.py
from fastapi import FastAPI, File, UploadFile from fastapi.responses import HTMLResponse app = FastAPI() @app.post("/files/") async def create_files( files: list[bytes] = File(description="Multiple files as bytes"), ): return {"file_sizes": [len(file) for file in files]} @app.post("/uploadfiles/") async def create_upload_files( files: list[UploadFile] = File(description="Multiple files as UploadFile"), ):
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Fri May 13 23:38:22 UTC 2022 - 888 bytes - Viewed (0) -
docs/em/docs/tutorial/request-files.md
✔️ 🤯 👈 👉 ⛓ 👈 🎂 🎚 🔜 🏪 💾. 👉 🔜 👷 👍 🤪 📁. ✋️ 📤 📚 💼 ❔ 👆 💪 💰 ⚪️➡️ ⚙️ `UploadFile`. ## 📁 🔢 ⏮️ `UploadFile` 🔬 📁 🔢 ⏮️ 🆎 `UploadFile`: ```Python hl_lines="12" {!../../docs_src/request_files/tutorial001.py!} ``` ⚙️ `UploadFile` ✔️ 📚 📈 🤭 `bytes`: * 👆 🚫 ✔️ ⚙️ `File()` 🔢 💲 🔢. * ⚫️ ⚙️ "🧵" 📁:
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Sun Oct 06 20:36:54 UTC 2024 - 6.6K bytes - Viewed (0)