[
https://issues.apache.org/jira/browse/CB-10044?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15015454#comment-15015454
]
ASF GitHub Bot commented on CB-10044:
-------------------------------------
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.
> Update FileTransfer plugin to upload a part of a file to be able to be used
> with ResumableJS
> --------------------------------------------------------------------------------------------
>
> Key: CB-10044
> URL: https://issues.apache.org/jira/browse/CB-10044
> Project: Apache Cordova
> Issue Type: Improvement
> Components: Plugin File Transfer
> Affects Versions: 3.5.0
> Environment: Android and iOS
> Reporter: Marco Antonio Ortega Moulin
> Assignee: Marco Antonio Ortega Moulin
> Priority: Minor
> Labels: Android, iOS
> Original Estimate: 24h
> Remaining Estimate: 24h
>
> When using Resumablejs we want to be able to use the FileTransfer plugin to
> upload parts of a file. In order to do this we will be sending the startByte
> and endByte parameters to the FileTransfer plugin.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]