Symfony UX LiveComponent file upload works only on first request #3125
Unanswered
woweya
asked this question in
Questions & Answers
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hello everyone,
I’m not quite sure if this is a bug or If I did something wrong but:
I’m having trouble with file uploads in Symfony UX LiveComponent.
I’m using Symfony 7.2, Symfony UX 2.x, and PHP 8.2.
The problem
I have a LiveComponent form that includes a file upload field.
On the first upload, everything works perfectly — the file is received in the request, saved correctly, and the component re-renders as expected.
However, when I try to upload another file after the re-render, the request no longer includes the file.
In the browser’s Network tab (
AJAX call: save
), the second request doesn’t contain any file in therequest
.Code examples
Form Type
LiveComponent method
Twig template
What I tried
enctype="multipart/form-data"
.The question
Why does the file upload only work on the first request?
Is this a known LiveComponent bug or am I missing some configuration to persist the file input across re-renders?
Beta Was this translation helpful? Give feedback.
All reactions