-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
HttpClient not support upload file with chinese name #41249
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Thanks for the report. This is issue is for the When submitting this file, neither Chrome nor Firefox generate the I guess we should start accepting UTF-8 in |
We should also give feedback at https://trac.ietf.org/trac/httpbis/wiki/ContentDispositionProducers |
Hey, thanks for your report! |
Could I get an answer? If I do not hear anything I will assume this issue is resolved or abandoned. Please get back to me <3 |
Hey, I didn't hear anything so I'm going to close it. Feel free to comment if this is still relevant, I can always reopen! |
Not solved |
…las-grekas) This PR was merged into the 4.4 branch. Discussion ---------- [Mime] Fix encoding filenames in multipart/form-data | Q | A | ------------- | --- | Branch? | 4.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | Fix #41249 | License | MIT | Doc PR | - File uploads that use forms have stick to browsers' behavior. This is captured in the WHATWG in their living standard: https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#multipart-form-data curl did the same a few weeks ago: curl/curl#7805 Commits ------- a58c342 [Mime] Fix encoding filenames in multipart/form-data
Symfony version(s) affected: 4.4.13
Description
HttpClient upload file with chinese name, but server cannot accept it.
How to reproduce
client:
server:
The right result should have
$_FILES
, but no.Possible Solution
I log formData info use this:
file_put_contents(__DIR__ . '/a.txt', $formData->toString());
, and getContent-Type: multipart/form-data; boundary=RGWgOk4l --RGWgOk4l Content-Type: text/plain Content-Transfer-Encoding: 8bit Content-Disposition: form-data; name="files"; filename*=utf-8''"%E4%B8%AD%E6%96%87.txt" 中文 --RGWgOk4l--
When I change
Content-Disposition: form-data; name="files"; filename*=utf-8''"%E4%B8%AD%E6%96%87.txt"
to
Content-Disposition: form-data; name="files"; filename="中文.txt"
or
Content-Disposition: form-data; name="files"; filename="中文.txt"; filename*=utf-8''"%E4%B8%AD%E6%96%87.txt"
It correct uploaded!
But I dont known how to fix this
Additional context
The text was updated successfully, but these errors were encountered: