- Sort Score
- Num 10 results
- Language All
Results 11 - 20 of 58 for uploadeFile (0.06 seconds)
-
tests/test_request_params/test_file/test_optional.py
@app.post("/optional-uploadfile", operation_id="optional_uploadfile") async def read_optional_uploadfile(p: Annotated[UploadFile | None, 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): openapi = app.openapi()
Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Sat Feb 21 13:01:31 GMT 2026 - 9.8K bytes - Click Count (0) -
tests/test_request_params/test_file/test_list.py
@app.post("/list-uploadfile", operation_id="list_uploadfile") async def read_list_uploadfile(p: Annotated[list[UploadFile], File()]): return {"file_size": [file.size for file in p]} @pytest.mark.parametrize( "path", [ "/list-bytes", "/list-uploadfile", ], ) def test_list_schema(path: str): openapi = app.openapi()
Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Sat Feb 21 13:01:31 GMT 2026 - 11.6K bytes - Click Count (0) -
docs/fr/docs/tutorial/request-files.md
Mais dans plusieurs cas, vous pourriez bénéficier de l'utilisation d'`UploadFile`. ## Paramètres de fichier avec `UploadFile` { #file-parameters-with-uploadfile } Définissez un paramètre de fichier de type `UploadFile` : {* ../../docs_src/request_files/tutorial001_an_py310.py hl[14] *} Utiliser `UploadFile` présente plusieurs avantages par rapport à `bytes` :Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Thu Mar 19 18:37:13 GMT 2026 - 8.2K bytes - Click Count (0) -
docs/es/docs/tutorial/request-files.md
Pero hay varios casos en los que podrías beneficiarte de usar `UploadFile`. ## Parámetros de Archivo con `UploadFile` { #file-parameters-with-uploadfile } Define un parámetro de archivo con un tipo de `UploadFile`: {* ../../docs_src/request_files/tutorial001_an_py310.py hl[14] *} Usar `UploadFile` tiene varias ventajas sobre `bytes`:Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Thu Mar 19 18:15:55 GMT 2026 - 7.6K bytes - Click Count (0) -
docs/zh/docs/tutorial/request-files.md
如果把*路径操作函数*参数的类型声明为 `bytes`,**FastAPI** 会为你读取文件,并以 `bytes` 的形式接收其内容。 请注意,这意味着整个内容会存储在内存中,适用于小型文件。 不过,在很多情况下,使用 `UploadFile` 会更有优势。 ## 含 `UploadFile` 的文件参数 { #file-parameters-with-uploadfile } 将文件参数的类型声明为 `UploadFile`: {* ../../docs_src/request_files/tutorial001_an_py310.py hl[14] *} 与 `bytes` 相比,使用 `UploadFile` 有多项优势: * 无需在参数的默认值中使用 `File()`。 * 它使用“spooled”文件: * 文件会先存储在内存中,直到达到最大上限,超过该上限后会写入磁盘。Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Fri Mar 20 17:06:37 GMT 2026 - 6.8K bytes - Click Count (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` { #file-parameters-with-uploadfile } Define a file parameter with a type of `UploadFile`: {* ../../docs_src/request_files/tutorial001_an_py310.py hl[14] *} Using `UploadFile` has several advantages over `bytes`: * You don't have to use `File()` in the default value of the parameter.Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Thu Mar 05 18:13:19 GMT 2026 - 7K bytes - Click Count (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` { #file-parameters-with-uploadfile } Defina um parâmetro de arquivo com um tipo de `UploadFile`: {* ../../docs_src/request_files/tutorial001_an_py310.py hl[14] *} Utilizar `UploadFile` tem várias vantagens sobre `bytes`:Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Thu Mar 19 18:20:43 GMT 2026 - 7.8K bytes - Click Count (0) -
docs/zh-hant/docs/tutorial/request-files.md
如果你將路徑操作函式(path operation function)的參數型別宣告為 `bytes`,**FastAPI** 會替你讀取檔案,你會以 `bytes` 取得內容。 請注意,這表示整個內容會存放在記憶體中,適合小檔案。 但在許多情況下,使用 `UploadFile` 會更好。 ## 使用 `UploadFile` 的檔案參數 { #file-parameters-with-uploadfile } 將檔案參數型別設為 `UploadFile`: {* ../../docs_src/request_files/tutorial001_an_py310.py hl[14] *} 使用 `UploadFile` 相較於 `bytes` 有數個優點: * 你不必在參數的預設值使用 `File()`。 * 它使用「spooled」檔案: * 檔案在記憶體中保存到某個大小上限,超過上限後會存到磁碟。Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Fri Mar 20 17:05:38 GMT 2026 - 6.6K bytes - Click Count (0) -
tests/test_datastructures.py
app = FastAPI() testing_file_store: list[UploadFile] = [] @app.post("/uploadfile/") def create_upload_file(file: UploadFile): testing_file_store.append(file) return {"filename": file.filename} client = TestClient(app) with path.open("rb") as file: response = client.post("/uploadfile/", files={"file": file}) assert response.status_code == 200, response.text
Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Sat Dec 20 15:55:38 GMT 2025 - 1.8K bytes - Click Count (0) -
docs/tr/docs/tutorial/request-files.md
Ancak bazı durumlarda `UploadFile` kullanmak size fayda sağlayabilir. ## `UploadFile` ile Dosya Parametreleri { #file-parameters-with-uploadfile } Tipi `UploadFile` olan bir dosya parametresi tanımlayın: {* ../../docs_src/request_files/tutorial001_an_py310.py hl[14] *} `UploadFile` kullanmanın `bytes`’a göre birkaç avantajı vardır:Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Fri Mar 20 07:53:17 GMT 2026 - 7.5K bytes - Click Count (0)