Some refactoring on new upload

Extracts the part for upload file creation into a helper. It returns an
upload file no matter if you give it a path or data.frame. This reduces
the parameters required in the upload function.