You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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 the request.
Verified that the form has enctype="multipart/form-data".
Checked that the request actually contains files on the first call (it does).
Compared the first and second AJAX calls — the second one doesn’t include any file.
No JavaScript console errors.
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?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
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