Fix use of slice function

This is a small fix for slice function usage.
The slice expect to receive a start and end byte position not start and length.
I also made some changes to allow use the same process to upload files with moov in the right position.