On Wed, Jan 20, 2010 at 12:12 AM, Kent Barber <[email protected]> wrote: > Hi, > > If I was going to use sling to upload large files (100Meg upwards) what > happens if the connection is dropped halfway through? Is the data in the JCR > corrupted ( partially uploaded)? Does it only overwrite the existing file > after it has completely uploaded? > > Would it be possible to provide a MD5 checksum as a parameter when it is > uploaded and make sure that when the upload is finished it compares checksums > to ensure its correct before doing the final overwrite of the previous > version of the file?
I'm not sure about the first part of your question, but what should be possible, is to write a SlingPostProcessor [1] to do the checksum validation. The postprocessor is called before the session is saved, so if validation fails, you can call a session.refresh(false) to discard the pending changes. [1] http://sling.apache.org/apidocs/sling5/org/apache/sling/servlets/post/SlingPostProcessor.html -- Vidar S. Ramdal <[email protected]> - http://www.idium.no Sommerrogata 13-15, N-0255 Oslo, Norway + 47 22 00 84 00 / +47 21 531941, ext 2070
