Fixed issue with uploading remote files

There is an issue when `$inputStream` is a network stream, e.g. the result of `fopen('http://example.com')`. In that case according to [manual](http://www.php.net/manual/en/function.fread.php#example-2351), `fread()` not surely returns the desired number of bytes. This leads to the fact that the size of uploaded chunks are not exactly 4MB but just unpredictable (in my case it was from 4K to 8K) and thus 20MB file was splitted into more than thousand chunks and upload process took ages.