将多个图像上传到ftp服务器

时间:2015-08-31 05:39:55

标签: ios objective-c ftp

我目前正在使用IOS应用程序,可用于将多个映像上传到ftp服务器。我正在使用GoldRaccoon类文件。我选择了5张图片,但它只上传了最后一张图片。

 - (void)zcImagePickerController:(ZCImagePickerController *)imagePickerController didFinishPickingMediaWithInfo:(NSArray *)info {
[self dismissPickerView];

NSString *fullPath;
 for (NSDictionary *imageDic in info) {

    UIImageView *imageView = [[UIImageView alloc] initWithImage:[imageDic objectForKey:UIImagePickerControllerOriginalImage]];
    imageView.contentMode = UIViewContentModeScaleAspectFit;
    [arrImageView addObject:imageView];

    UIImage *image1 = [imageDic objectForKey:@"UIImagePickerControllerOriginalImage"];
    NSData * imageData1 = UIImageJPEGRepresentation(image1,100); //convert image into .png format.
    NSFileManager * fileManager = [NSFileManager defaultManager];//create instance of NSFileManager
    NSArray * paths1 = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); //create an array and store result of our search for the documents directory in it
    NSString * documentsDirectory = [paths1 objectAtIndex:0]; //create NSString object, that holds our exact path to the documents directory

    fullPath = [documentsDirectory stringByAppendingPathComponent:[NSString stringWithFormat:@"%@.jpg",image1]]; //add our image to the path

  //  NSString *str=[NSString stringWithFormat:@"%@.jpg",image1];

    [fileManager createFileAtPath:fullPath contents:imageData1 attributes:nil]; //finally save the image

    [arrvalue addObject:fullPath];

    NSURL *imageURL = [imageDic valueForKey:UIImagePickerControllerReferenceURL];
    ALAssetsLibraryAssetForURLResultBlock resultblock =^(ALAsset *myasset)
    {
        ALAssetRepresentation *representation = [myasset defaultRepresentation];
        NSString *fileName = [representation filename];
        // Send WebService
      //  [arrName addObject:fileName];
        [self sendImage:fileName :fullPath];
    };

    ALAssetsLibrary* assetslibrary = [[ALAssetsLibrary alloc] init] ;
    [assetslibrary assetForURL:imageURL resultBlock:resultblock failureBlock:nil];

 }
}

0 个答案:

没有答案