Reputation: 23333
I'm using following uploader - http://valums.com/ajax-upload/ . It calls method where I get MultipartFile. The question is: how can I detect the situation that the file is not correctly uploaded - user canceled uploading or something else?
The sample upload server code (it's groovy)
`def upload = { File file = createTemporaryFile() InputStream inputStream = selectInputStream(request) file << inputStream }
private InputStream selectInputStream(HttpServletRequest request) {
if (request instanceof MultipartHttpServletRequest) {
MultipartFile uploadedFile = ((MultipartHttpServletRequest) request).getFile('qqfile')
return uploadedFile.inputStream
}
return request.inputStream
}`
Upvotes: 0
Views: 207
Reputation: 19225
Im not sure if there's a 'standard' way, but why not transmit a hash with the file?
Once upload is complete, calculate the hash on the server and see if it matches.
Upvotes: 1