private void processFileUpload( FileItem f ) throws ConflictException {
String sFolder = params.get( "CurrentFolder" );
log.debug( "sFolder: " + sFolder + " - " + sFolder.length() );
String relFolder = sFolder.substring( 1 );
Path p = Path.path( relFolder );
Resource r = find( wrappedResource, p );
if( r instanceof PutableResource ) {
target = (PutableResource) r;
}
if( target == null ) {
log.warn( "No putable folder with that path: " + sFolder );
throw new ConflictException( target );
}
String name = f.getName(); //utilFile().sanitiseName(f.getName());
log.debug( "processFileUpload: " + name );
boolean isFirst = true;
while( target.child( name ) != null ) {
name = FileUtils.incrementFileName( name, isFirst );
newName = name;
isFirst = false;
}
PutableResource putable;
if( target instanceof PutableResource) {
putable = (PutableResource) target;
} else {
log.warn("The collection is not putable: " + r.getName() + " - " + r.getClass().getCanonicalName());
throw new ConflictException( r );
}
long size = f.getSize();
try {
Resource newRes = putable.createNew( name, f.getInputStream(), size, null );
} catch( ConflictException ex ) {
throw ex;
} catch( NotAuthorizedException ex ) {
throw new RuntimeException( ex );
} catch( BadRequestException ex ) {