Fixed issue with uploadDocument function where wrong filename was used.