Hi Thusitha Maybe you need save the upload-file stream into a temporary file on your server. And then, you can access the file content from the temporary file
2016-05-30 14:43 GMT+09:00 Thusitha Thilina Dayaratne < [email protected]>: > Hi All, > > I'm trying to use apache commons-fileupload to support file streaming with > my own rest framework. I get a multipart/form-data request from the client > side and want to the file as as stream to the backend. > > FileItemIterator iter = upload.getItemIterator(request); > > while (iter.hasNext()) { > > FileItemStream item = iter.next(); > > // Add objects to a map (I don't want to process the stream here. > > Just pass) > > ..... // If I access the stream here no errors and everything ok > > } > > > But in the backend side when I'm trying to access the stream I'm getting > ItemSkippedException > AFAIU it seems that hasNext() method closes the stream. Therefore I have to > consume the stream before calling next hasNext(). > But I just want to access as a proxy and consume the stream later. Is there > a possible way for me to consume the stream later ? > > -- > Thanks > Thusitha >
