Removed unused imports and set chunked streaming mode to upload
connection, to avoid out of memory exceptions when uploading large
files. Thanks to @derekentringer for reporting the issue and for testing