http上传 把文件以body形式上传到服务器
```
NSFileHandle* handler = [NSFileHandle fileHandleForReadingAtPath:_fileURL];
[handler seekToFileOffset:(unsigned long long)_range.location];
NSData* body = [handler readDataOfLength:_range.length];
NSMutableURLRequest *request = [[NSMutableURLRequest alloc] initWithURL:[NSURL URLWithString:url]];
[request setHTTPMethod:@"POST"];
[request setValue:@"video/mp4" forHTTPHeaderField:@"Content-Type"];
[request setValue:[NSString stringWithFormat:@"%d",body.length] forHTTPHeaderField:@"Content-Length"];
[request setValue:@"no-cache" forHTTPHeaderField:@"Cache-Control"];
[request setHTTPBody:body];
```
然后服务器接收body 二进制流
网友评论