correctly rewind temp file so the contents is correctly uploaded to server