在一个 ASIHTTPRequest 中流式传输多个文件的最佳实践是什么?
现在,对于我使用的一个文件:
....
ASIHTTPRequest *request = [[ASIHTTPRequest alloc] initWithURL:someUrl];
[request setShouldStreamPostDataFromDisk:YES];
[request appendPostDataFromFile:someFilePath];
[request startSynchronous];
如何在传输前不将所有文件放入内存的情况下流式传输多个文件?
最佳答案
在这种情况下,
ASIFormDataRequest 可能是更好的选择。这样就可以完成多部分 POST:
...
ASIFormDataRequest *request = [[ASIFormDataRequest alloc] initWithURL:url];
[request setShouldStreamPostDataFromDisk:YES];
[request setFile:someFilePath forKey:@"file1"];
[request setFile:someOtherFilePath forKey:@"file2"];
[request startAsynchronous];
关于iphone - 在 _one_ ASIHTTPRequest 中流式传输多个文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2574305/