fixed upload bug, more beauty code

Uploading two files consecutively would resolve in the second file
being corrupted, and the third file returning a HPE_INVALID_CONSTANT
error.
The problem was that in a specific case (upload file, then create a
ticket with the received token) the body was sent together with file,
which created a corrupt file.
Merge branch 'upload_fix'
Merge branch 'master' into upload_fix
Merge branch 'upload_fix'