Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 37 for uploadFile (0.05 sec)

  1. 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)
  2. 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)
  3. 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)
  4. 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)
  5. 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()
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Sat Dec 27 18:31:34 UTC 2025
    - 11.2K bytes
    - Viewed (0)
  6. 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_py39.py hl[14] *}
    
    Using `UploadFile` has several advantages over `bytes`:
    
    * You don't have to use `File()` in the default value of the parameter.
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Sun Aug 31 09:15:41 UTC 2025
    - 7.3K bytes
    - Viewed (0)
  7. 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_py39.py hl[14] *}
    
    Utilizar `UploadFile` tem várias vantagens sobre `bytes`:
    
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Wed Nov 12 16:23:57 UTC 2025
    - 8.1K bytes
    - Viewed (0)
  8. tests/test_request_params/test_file/test_required.py

    
    @app.post("/required-uploadfile", operation_id="required_uploadfile")
    async def read_required_uploadfile(p: Annotated[UploadFile, File()]):
        return {"file_size": p.size}
    
    
    @pytest.mark.parametrize(
        "path",
        [
            "/required-bytes",
            "/required-uploadfile",
        ],
    )
    def test_required_schema(path: str):
        openapi = app.openapi()
        body_model_name = get_body_model_name(openapi, path)
    
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Sat Dec 27 18:19:10 UTC 2025
    - 10.8K bytes
    - Viewed (0)
  9. 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_py39.py hl[14] *}
    
    Usar `UploadFile` tiene varias ventajas sobre `bytes`:
    
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Tue Dec 16 16:33:45 UTC 2025
    - 7.9K bytes
    - Viewed (0)
  10. 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
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Sat Dec 20 15:55:38 UTC 2025
    - 1.8K bytes
    - Viewed (0)
Back to top