Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 35 for uploadFile (0.06 sec)

  1. 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)
  2. 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)
  3. 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)
  4. 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)
  5. 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`
    
    Definieren Sie einen Datei-Parameter mit dem Typ `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
    - 11.3K bytes
    - Viewed (0)
  6. docs/pt/docs/tutorial/request_files.md

    Mas existem vários casos em que você pode se beneficiar ao usar `UploadFile`.
    
    ## Parâmetros de arquivo com `UploadFile`
    
    Defina um parâmetro de arquivo com o tipo `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.8K bytes
    - Viewed (0)
  7. fastapi/datastructures.py

        ```python
        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):
            return {"filename": file.filename}
        ```
        """
    
        file: Annotated[
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Tue Apr 02 02:48:51 UTC 2024
    - 5.6K bytes
    - Viewed (0)
  8. tests/test_multipart_installation.py

    import warnings
    
    import pytest
    from fastapi import FastAPI, File, Form, UploadFile
    from fastapi.dependencies.utils import (
        multipart_incorrect_install_error,
        multipart_not_installed_error,
    )
    
    
    def test_incorrect_multipart_installed_form(monkeypatch):
        monkeypatch.setattr("python_multipart.__version__", "0.0.12")
        with warnings.catch_warnings(record=True):
            warnings.simplefilter("always")
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sun Oct 27 21:46:26 UTC 2024
    - 5.7K bytes
    - Viewed (0)
  9. tests/test_compat.py

        # For coverage
        # TODO: in theory this would allow declaring types that could be lists of UploadFile
        # and other types, but I'm not even sure it's a good idea to support it as a first
        # class "feature"
        assert is_uploadfile_sequence_annotation(Union[List[str], List[UploadFile]])
    
    
    def test_is_pv1_scalar_field():
        # For coverage
        class Model(BaseModel):
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Wed Sep 11 07:45:30 UTC 2024
    - 3.5K bytes
    - Viewed (0)
  10. docs/zh/docs/tutorial/request-files.md

    文件作为「表单数据」上传。
    
    如果把*路径操作函数*参数的类型声明为 `bytes`,**FastAPI** 将以 `bytes` 形式读取和接收文件内容。
    
    这种方式把文件的所有内容都存储在内存里,适用于小型文件。
    
    不过,很多情况下,`UploadFile` 更好用。
    
    ## 含 `UploadFile` 的文件参数
    
    定义文件参数时使用 `UploadFile`:
    
    ```Python hl_lines="12"
    {!../../docs_src/request_files/tutorial001.py!}
    ```
    
    `UploadFile` 与 `bytes` 相比有更多优势:
    
    * 使用 `spooled` 文件:
        * 存储在内存的文件超出最大上限时,FastAPI 会把文件存入磁盘;
    * 这种方式更适于处理图像、视频、二进制文件等大型文件,好处是不会占用所有内存;
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sun Oct 06 20:36:54 UTC 2024
    - 6.9K bytes
    - Viewed (0)
Back to top