Add generic upload file method
Several improvements on save issues and rest communication