Adde dconfigureable chunk size.
Fixed bug in uploading and added more debugging.