Github user daserge commented on a diff in the pull request: https://github.com/apache/cordova-plugin-file-transfer/pull/116#discussion_r45447454 --- Diff: src/ios/CDVFileTransfer.m --- @@ -259,13 +259,35 @@ - (NSURLRequest*)requestForUploadCommand:(CDVInvokedUrlCommand*)command fileData CFRelease(writeStream); }]; } else { + NSNumber* startByte = (NSNumber*)[command argumentAtIndex:11 withDefault:0]; + NSNumber* endByte = (NSNumber*)[command argumentAtIndex:12 withDefault:0]; + + NSInteger i_startByte = [startByte integerValue]; + NSInteger i_endByte = [endByte integerValue]; + + if(i_endByte == 0){ + i_endByte = -1; + } + NSRange chunkRange = NSMakeRange(i_startByte, i_endByte-i_startByte); + NSData* chunkData = [fileData subdataWithRange:chunkRange]; + if (multipartFormUpload) { - [postBodyBeforeFile appendData:fileData]; + [postBodyBeforeFile appendData:chunkData]; + //[postBodyBeforeFile appendData:fileData]; [postBodyBeforeFile appendData:postBodyAfterFile]; [req setHTTPBody:postBodyBeforeFile]; } else { - [req setHTTPBody:fileData]; + [req setHTTPBody:chunkData]; + //[req setHTTPBody:fileData]; } + + // if (multipartFormUpload) { + // [postBodyBeforeFile appendData:fileData]; + // [postBodyBeforeFile appendData:postBodyAfterFile]; + // [req setHTTPBody:postBodyBeforeFile]; + // } else { + // [req setHTTPBody:fileData]; + // } --- End diff -- Please remove unnecessary comments.
--- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. --- --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@cordova.apache.org For additional commands, e-mail: dev-h...@cordova.apache.org