Fixed document upload by file. Added integration tests.