Describe the bug
I want to pass an additional argument to the on_drop handler so that I can determine which field is uploaded into:
on_drop=State.handle_upload(rx.upload_files(upload_id=str(field)), field),
However, an error occurs:
TypeError: State.handle_upload() missing 1 required positional argument: 'field'
To Reproduce
Steps to reproduce the behavior:
class State(rx.State):
fields: rx.Field[list[str]] = rx.field(["field1", "field2"])
@rx.event
async def handle_upload(self, files: list[rx.UploadFile], field: str) -> None:
print("field", field)
for file in files:
print("file", file)
def index() -> rx.Component:
return rx.foreach(
State.fields,
lambda field: rx.fragment(
rx.text(field),
rx.upload(
rx.text(
"Drag and drop files here or click to select files"
),
id=str(field),
multiple=False,
max_files=1,
on_drop=State.handle_upload(rx.upload_files(upload_id=str(field)), field),
)
)
)
Expected behavior
No error.
Screenshots

Specifics (please complete the following information):
- Python Version: 3.11.12
- Reflex Version: 0.7.11
- OS: macOS
- Browser (Optional):
Additional context
Related discussion: https://github.com/orgs/reflex-dev/discussions/5266
Describe the bug
I want to pass an additional argument to the
on_drophandler so that I can determine which field is uploaded into:However, an error occurs:
To Reproduce
Steps to reproduce the behavior:
Expected behavior
No error.
Screenshots
Specifics (please complete the following information):
Additional context
Related discussion: https://github.com/orgs/reflex-dev/discussions/5266