You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jun 17, 2024. It is now read-only.
I found that the upload only support NSData and NSInputStream, however when i upload an file larger than 1GB, the app will crash as the memory is limited, I found that someone adjust me to upload by NSFileHandler to post data by pieces, I separated the file to every piece of 1MB, and use the http-header "Content-Range", but it seems not work, it can only upload the first 1MB, and this is my code according to the msdn library, I didn't know if the server support this way:
NSData *putData = [self uploadSubdataWithOffset:offset length:dataLength];
NSString *rangeString = [NSString stringWithFormat:@"bytes */%lu-%lu/%lu",(unsigned long)offset,(unsigned long)offset+dataLength-1,(unsigned long)dataLength];
[_request setValue:rangeString forHTTPHeaderField:@"Content-Range"];
[_request setValue:[NSString stringWithFormat:@"%llu",(unsigned long long)_chunckSize] forHTTPHeaderField:@"Content-Length"];
[_request setValue:[NSString stringWithFormat:@"%llu",[_fileHandler seekToEndOfFile]] forHTTPHeaderField:@"X-Upload-Content-Length"];
[_request setValue:[self fileMimeType:uploadFilePath] forHTTPHeaderField:@"X-Upload-Content-Type"];
As I need the uploading pause and resume, and the large file must support as well,so I had to do it by this, can you give me any help about this? Thanks very much for your patient
The text was updated successfully, but these errors were encountered:
I found that the upload only support NSData and NSInputStream, however when i upload an file larger than 1GB, the app will crash as the memory is limited, I found that someone adjust me to upload by NSFileHandler to post data by pieces, I separated the file to every piece of 1MB, and use the http-header "Content-Range", but it seems not work, it can only upload the first 1MB, and this is my code according to the msdn library, I didn't know if the server support this way:
NSData *putData = [self uploadSubdataWithOffset:offset length:dataLength];
NSString *rangeString = [NSString stringWithFormat:@"bytes */%lu-%lu/%lu",(unsigned long)offset,(unsigned long)offset+dataLength-1,(unsigned long)dataLength];
[_request setValue:rangeString forHTTPHeaderField:@"Content-Range"];
[_request setValue:[NSString stringWithFormat:@"%llu",(unsigned long long)_chunckSize] forHTTPHeaderField:@"Content-Length"];
[_request setValue:[NSString stringWithFormat:@"%llu",[_fileHandler seekToEndOfFile]] forHTTPHeaderField:@"X-Upload-Content-Length"];
[_request setValue:[self fileMimeType:uploadFilePath] forHTTPHeaderField:@"X-Upload-Content-Type"];
As I need the uploading pause and resume, and the large file must support as well,so I had to do it by this, can you give me any help about this? Thanks very much for your patient
The text was updated successfully, but these errors were encountered: