我尝试将许多文件上传到iOS-App中的ftp服务器
以下代码在没有循环的情况下工作正常,但是当我添加循环时,使用新文件名查看路径是否正确,但没有上传任何内容。
仅使用marvel9.jpg在ftp-server上创建最后一个文件,但大小为0。
- (IBAction) uploadFile :(id)sender
{
NSString *applicationDocumentsDir = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0];
NSString *filepath = [NSString stringWithFormat: @"%@/%@", applicationDocumentsDir, @"marvel.jpg"];
InfoLog(@"%@", filepath);
uploadData = [NSData dataWithContentsOfFile: filepath];
uploadFile = [[BRRequestUpload alloc] initWithDelegate:self];
uploadFile.hostname = host.text;
uploadFile.username = username.text;
uploadFile.password = password.text;
for(int i = 0; i < 10; i++)
{
uploadFile.path = [NSString stringWithFormat:@"%@/marvel%d.jpg", path.text, i];
InfoLog(@"%@", uploadFile.path);
[uploadFile start];
}
}