- Sort Score
- Result 10 results
- Languages All
Results 1 - 10 of 45 for upload_files (0.12 sec)
-
tests/test_optional_file_list.py
from typing import Optional from fastapi import FastAPI, File from fastapi.testclient import TestClient app = FastAPI() @app.post("/files") async def upload_files(files: Optional[list[bytes]] = File(None)): if files is None: return {"files_count": 0} return {"files_count": len(files), "sizes": [len(f) for f in files]} def test_optional_bytes_list(): client = TestClient(app) response = client.post(
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Wed Dec 17 21:25:59 UTC 2025 - 821 bytes - Viewed (0) -
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 - readRegistered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Thu Apr 18 19:53:19 UTC 2024 - 472 bytes - Viewed (0) -
tests/test_tutorial/test_request_files/test_tutorial003.py
path2 = tmp_path / "test2.txt" path2.write_bytes(b"<file content2>") client = TestClient(app) with path.open("rb") as file, path2.open("rb") as file2: response = client.post( "/uploadfiles/", files=( ("files", ("test.txt", file)), ("files", ("test2.txt", file2)), ), ) assert response.status_code == 200, response.text
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Wed Dec 17 20:41:43 UTC 2025 - 7.5K bytes - Viewed (0) -
fastapi/datastructures.py
from starlette.datastructures import UploadFile as StarletteUploadFile class UploadFile(StarletteUploadFile): """ A file uploaded in a request. Define it as a *path operation function* (or dependency) parameter. If you are using a regular `def` function, you can use the `upload_file.file` attribute to access the raw standard Python file (blocking, not async), useful andRegistered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Sat Dec 27 12:54:56 UTC 2025 - 5.1K bytes - Viewed (0) -
src/main/webapp/WEB-INF/view/admin/storage/admin_storage.jsp
key="labels.storage_file"/></label> <div class="form-inline col-sm-9"> <input type="file" name="uploadFile" id="uploadFile" class="form-control-file"/>
Registered: Sat Dec 20 09:19:18 UTC 2025 - Last Modified: Thu Nov 13 05:54:52 UTC 2025 - 20.7K bytes - Viewed (0) -
tests/test_request_params/test_file/test_optional_list.py
@app.post("/optional-list-uploadfile") async def read_optional_list_uploadfile( p: Annotated[Optional[list[UploadFile]], File()] = None, ): return {"file_size": [file.size for file in p] if p else None} @pytest.mark.parametrize( "path", [ "/optional-list-bytes", "/optional-list-uploadfile", ], ) def test_optional_list_schema(path: str):
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Sat Dec 27 18:19:10 UTC 2025 - 10.4K bytes - Viewed (0) -
tests/test_tutorial/test_request_files/test_tutorial002.py
path2 = tmp_path / "test2.txt" path2.write_bytes(b"<file content2>") client = TestClient(app) with path.open("rb") as file, path2.open("rb") as file2: response = client.post( "/uploadfiles/", files=( ("files", ("test.txt", file)), ("files", ("test2.txt", file2)), ), ) assert response.status_code == 200, response.text
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Sat Dec 27 18:19:10 UTC 2025 - 8.2K bytes - Viewed (0) -
docs/de/docs/tutorial/request-files.md
Aber es gibt viele Fälle, in denen Sie davon profitieren, `UploadFile` zu verwenden. ## Datei-Parameter mit `UploadFile` { #file-parameters-with-uploadfile } Definieren Sie einen Datei-Parameter mit dem Typ `UploadFile`: {* ../../docs_src/request_files/tutorial001_an_py39.py hl[14] *} `UploadFile` zu verwenden, hat mehrere Vorzüge gegenüber `bytes`:Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Sat Sep 20 15:10:09 UTC 2025 - 8.7K bytes - Viewed (0) -
docs/uk/docs/tutorial/request-files.md
Але в деяких випадках Вам може знадобитися `UploadFile`. ## Параметри файлу з `UploadFile` Визначте параметр файлу з типом `UploadFile`: {* ../../docs_src/request_files/tutorial001_an_py39.py hl[14] *} Використання `UploadFile` має кілька переваг перед `bytes`: * Вам не потрібно використовувати `File()` у значенні за замовчуванням параметра.Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Sat Feb 22 22:01:44 UTC 2025 - 11.2K bytes - Viewed (0) -
tests/test_request_params/test_file/test_optional.py
return {"file_size": len(p) if p else None} @app.post("/optional-uploadfile", operation_id="optional_uploadfile") async def read_optional_uploadfile(p: Annotated[Optional[UploadFile], File()] = None): return {"file_size": p.size if p else None} @pytest.mark.parametrize( "path", [ "/optional-bytes", "/optional-uploadfile", ], ) def test_optional_schema(path: str):Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Sat Dec 27 18:19:10 UTC 2025 - 9.7K bytes - Viewed (0)