I'm looking for a way to handle my data while the multipart-file is being transferred. I've tried servlet and spring boot but both can only direct me to the post function after all files are fully uploaded. is there a way to process the data without waiting for the transfer to be done? thanks
Asked
Active
Viewed 64 times
1
-
If you have only one file then you have to wait for that transfer to complete otherwise for multiple files you can use multiple ajax submit – Eshu Jan 03 '19 at 08:46
-
1Have you tried to use servlet request provided InputStream?`request.getInputStream();` – Robert Jan 03 '19 at 08:48
-
@Robert I think that function can only convert already uploaded data to binary. – Pittie Jan 03 '19 at 08:56
-
@Eshu I work on the backend side and the only thing i know from the frontend side is just a multipart/form-data post request. – Pittie Jan 03 '19 at 08:58
-
@Pittie In that case the only option is to wait because until the complete transfer is done – Eshu Jan 03 '19 at 09:06
-
@Pittie: There is two option 1) If your have large file then you can upload file by chunk. 2) you can do post asynchronous request for multipart-file and synchronous request for data – IMParasharG Jan 03 '19 at 09:14
-
As @Robert mentioned, you should use streaming for this. https://stackoverflow.com/questions/10326460/how-to-avoid-outofmemoryerror-when-uploading-a-large-file-using-jersey-client – mbsingh Jan 03 '19 at 09:14