Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 5 of 5 for create_upload_files (1.82 sec)

  1. docs_src/request_files/tutorial001_py39.py

    from fastapi import FastAPI, File, UploadFile
    
    app = FastAPI()
    
    
    @app.post("/files/")
    async def create_file(file: bytes = File()):
        return {"file_size": len(file)}
    
    
    @app.post("/uploadfile/")
    async def create_upload_file(file: UploadFile):
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Wed Dec 17 20:41:43 UTC 2025
    - 282 bytes
    - Viewed (0)
  2. docs_src/request_files/tutorial001_03_py39.py

    app = FastAPI()
    
    
    @app.post("/files/")
    async def create_file(file: bytes = File(description="A file read as bytes")):
        return {"file_size": len(file)}
    
    
    @app.post("/uploadfile/")
    async def create_upload_file(
        file: UploadFile = File(description="A file read as UploadFile"),
    ):
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Wed Dec 17 20:41:43 UTC 2025
    - 371 bytes
    - Viewed (0)
  3. docs_src/request_files/tutorial001_02_py39.py

        if not file:
            return {"message": "No file sent"}
        else:
            return {"file_size": len(file)}
    
    
    @app.post("/uploadfile/")
    async def create_upload_file(file: Union[UploadFile, None] = None):
        if not file:
            return {"message": "No upload file sent"}
        else:
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Wed Dec 17 20:41:43 UTC 2025
    - 508 bytes
    - Viewed (0)
  4. tests/test_datastructures.py

        path = tmp_path / "test.txt"
        path.write_bytes(b"<file content>")
        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:
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Sat Dec 20 15:55:38 UTC 2025
    - 1.8K bytes
    - Viewed (0)
  5. fastapi/datastructures.py

        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[
            BinaryIO,
            Doc("The standard Python file object (non-async)."),
        ]
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Sat Dec 27 12:54:56 UTC 2025
    - 5.1K bytes
    - Viewed (0)
Back to top