Formatting.
Added comments.
Fixed getTemporaryFileUploadDirectory behaviour by making it much
simpler.
Use overrideFile parameter and log a warning when overriding.
Added some debug log for upload.