In my java web application I have to process excel file from user. There are two way to process this first as File
second as InputStreams
.
I think InputStreams
will be a memory consuming thing.
Is there any possible threat if I first save user uploaded file as .xls
or .xlsx
and then process it?
What are the cons & pros of both approach?
The best way to process web application files is after uploading completely and saving in your server as a file.
Streaming file processing should be avoided because HTTP model is designed to be a Request, Response model. You shouldn't ask the Web Client wait until you finish the file processing.
Best thing to do is upload file to a directory and send the Web Client a upload success message, with possibly a link where the end user can check for the results in the future.
And having a scheduled task to process the files in the uploaded directory and post the results in the results page.
This way web application will not have unnecessary delays and scale-able.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.