After more investigation, the problems were coming from trying to run the upload in a separate thread. Once I move the code back into the main thread where the onSubmit is pressed it all works fine.
Is it possible to have the upload process take place in a separate thread, so the user can continue working while the upload takes place? Andrew Moore wrote: > > Just to follow this up. When using the inputstream and the read() method > on the same upload file. The number of lines read before getting in error > message changes each time. Could it be a jdk bug? > > > Andrew Moore wrote: >> >> I'm using wicket 1.3.4 and doing some file uploading and keep >> intermittantly getting the following error: >> IOException: The handle is invalid. >> >> My form is uploads zips and jpgs and is very similar to the wicket >> examples. >> ie in my submit button I do the following: >> >> if (uploadFile != null) { >> // Check new file, delete if it already existed >> imageProcessing.deleteFileIfExists(uploadFolder + File.separator + >> uploadFile.getClientFileName()); >> // Create a new file >> File newFile = new File(uploadFolder, uploadFile.getClientFileName()); >> try { >> // Save to new file >> newFile.createNewFile(); >> uploadFile.writeTo(newFile); >> }... >> >> >> It's the writeTo line that causes the error. Some jpgs and zips work >> fine, others don't or only intermittantly work. An example image I'm >> having errors with is this one: >> http://transfer.folioflow.com.s3.amazonaws.com/08092007045.jpg >> >> I've tried using the getInputStream() instead of the writeTo, and tried >> writing the inputstream into an output stream, but get exactly the same >> error while doing an inputstream.read(); >> >> I'm at a bit of a loss to what could be causing this. >> >> >> > > -- View this message in context: http://www.nabble.com/IOException%3A-The-handle-is-invalid---on-file-upload-tp18998030p19028996.html Sent from the Wicket - User mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]