Multipart not reading all/any parts
See original GitHub issueHi, I am trying to upload an image/file…
I ran into a problem that the multiplart.readAllParts()
returns everytime empty list, even when I send a file! I migrated from a version 0.3.2 (I think) to 0.9.1… I have read this issue: https://github.com/ktorio/ktor/issues/139 but it seems as no one has answered the question.
I have even tried creating a form with the correct enctype and uploading the file through the form, without any success. I also tried uploading the file through $.ajax() method in jqeury, also without any success.
My code:
if(call.request.isMultipart()) {
val multipart = call.receiveMultipart()
println("FILES:" + multipart.readPart())
multipart.forEachPart { part ->
when (part) {
is PartData.FileItem -> {
files += part
}
}
}
}
I was reading this documentation: http://ktor.io/servers/uploads.html
btw, thank you very much for developing ktor! I am developing my graduation project in it!
Issue Analytics
- State:
- Created 6 years ago
- Reactions:2
- Comments:14 (6 by maintainers)
Top Results From Across the Web
Not able to read Multipart file using spring controller when file ...
Able to read the file contents successfully in my server class (servlet) using the org.apache.commons.fileupload.servlet.ServletFileUpload APIs.
Read more >Uploading and copying objects using multipart upload
You can upload these object parts independently and in any order. If transmission of any part fails, you can retransmit that part without...
Read more >ZArchiver - Apps on Google Play
ZArchiver - is a program for archive management. It has a simple and functional interface. The app doesn't have permission to access the...
Read more >Jan. 6 panel urges Trump prosecution with criminal referral
The House Jan. 6 committee is urging the Justice Department to bring criminal charges against former President Donald Trump and his allies.
Read more >Hexis graphics - Centro Didattico Atesino
HEXIS catalogues - Now available as a digital edition for reading and ... FranceHexis Graphics Description HEXIS is not only a self-adhesive film ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I am using Ktor version: 0.9.2-alpha-2 with Netty engine. My code looks like:
I tried putting some debugging breakpoints. The call doesn’t seem to enter the forEachPart and server is stuck with no logs whatsoever. I am sending request with Postman and can confirm same multipart request works with my nodejs express server.
I tried running YouKube example. While running example, the browser seems to be stuck here pointing towards this issue only.
I reproduced the same bug as @betterclever
Ktor: 0.9.1 Engine: Netty
I guess its because of the
readPart()
It returns everytime null, I tried looking deeper into the code, but, since I did not design Ktor, it is very hard for me to understand the code 😕.