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 );