Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7762607
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T14:27:01+00:00 2026-06-01T14:27:01+00:00

Is it possible to upload a .zip file to iCloud , and then have

  • 0

Is it possible to upload a .zip file to iCloud, and then have it be synchronized across all of a user’s iOS devices?
If so, how would I go about doing this?
If there is any File size limit, then also mention max. file size allowed.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T14:27:03+00:00Added an answer on June 1, 2026 at 2:27 pm

    This is how I synchronized zip files with iCloud .

    Steps:

    1) http://transoceanic.blogspot.in/2011/07/compressuncompress-files-on.html
    . Refer this link to download zip api which is having code for zipping and unzipping folder.

    2) Now all you need to play with NSData.

    3) “MyDocument.h” file

    #import <UIKit/UIKit.h>
    
    @interface MyDocument : UIDocument
        @property (strong) NSData *zipDataContent;
    @end
    

    4)

    #import "MyDocument.h"
    
    @implementation MyDocument
    @synthesize zipDataContent;
    
    // Called whenever the application reads data from the file system
    - (BOOL)loadFromContents:(id)contents ofType:(NSString *)typeName error:(NSError **)outError
    {
        self.zipDataContent = [[NSData alloc] initWithBytes:[contents bytes] length:[contents length]];
        [[NSNotificationCenter defaultCenter] postNotificationName:@"noteModified" object:self];
        return YES;     
    }
    
    // Called whenever the application (auto)saves the content of a note
    - (id)contentsForType:(NSString *)typeName error:(NSError **)outError 
    {
        return self.zipDataContent;
    }
    
    @end
    

    5) Now somewhere in your app you need to zip folder and sync with icloud.

    -(BOOL)zipFolder:(NSString *)toCompress zipFilePath:(NSString *)zipFilePath
    {
        BOOL isDir=NO;
    
        NSString *documentsDirectory = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0];
        NSString *pathToCompress = [documentsDirectory stringByAppendingPathComponent:toCompress];
    
        NSArray *subpaths;
        NSFileManager *fileManager = [NSFileManager defaultManager]; 
        if ([fileManager fileExistsAtPath:pathToCompress isDirectory:&isDir] && isDir){
            subpaths = [fileManager subpathsAtPath:pathToCompress];
        } else if ([fileManager fileExistsAtPath:pathToCompress]) {
            subpaths = [NSArray arrayWithObject:pathToCompress];
        }
    
        zipFilePath = [documentsDirectory stringByAppendingPathComponent:zipFilePath];
        //NSLog(@"%@",zipFilePath);
        ZipArchive *za = [[ZipArchive alloc] init];
        [za CreateZipFile2:zipFilePath];
        if (isDir) {
            for(NSString *path in subpaths){  
                NSString *fullPath = [pathToCompress stringByAppendingPathComponent:path];
                if([fileManager fileExistsAtPath:fullPath isDirectory:&isDir] && !isDir){
                    [za addFileToZip:fullPath newname:path];  
                }
            }
        } else {
            [za addFileToZip:pathToCompress newname:toCompress];
        }
    
        BOOL successCompressing = [za CloseZipFile2];
        if(successCompressing)
            return YES;
        else
            return NO;
    }
    -(IBAction) iCloudSyncing:(id)sender  
    {
        //***** PARSE ZIP FILE : Pictures *****
        NSString *documentsDirectory = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0];
    
        if([self zipFolder:@"Pictures" zipFilePath:@"iCloudPictures"])
            NSLog(@"Picture Folder is zipped");
    
        ubiq = [[NSFileManager defaultManager]URLForUbiquityContainerIdentifier:nil];
        ubiquitousPackage = [[ubiq URLByAppendingPathComponent:@"Documents"]  URLByAppendingPathComponent:@"iCloudPictures.zip"];
    
        mydoc = [[MyDocument alloc] initWithFileURL:ubiquitousPackage];
        NSString *zipFilePath = [documentsDirectory stringByAppendingPathComponent:@"iCloudPictures"];
        NSURL *u = [[NSURL alloc] initFileURLWithPath:zipFilePath];
        NSData *data = [[NSData alloc] initWithContentsOfURL:u];
        // NSLog(@"%@ %@",zipFilePath,data);
        mydoc.zipDataContent = data;
    
        [mydoc saveToURL:[mydoc fileURL] forSaveOperation:UIDocumentSaveForCreating completionHandler:^(BOOL success) 
        {
            if (success) 
            {
                NSLog(@"PictureZip: Synced with icloud");
            }
            else
                NSLog(@"PictureZip: Syncing FAILED with icloud");
    
        }];
    }
    

    6) You can unzip data received from iCloud like this.

    - (void)loadData:(NSMetadataQuery *)queryData {
    
    
    
        for (NSMetadataItem *item in [queryData results]) 
        {    
            NSString *filename = [item valueForAttribute:NSMetadataItemDisplayNameKey];
    
    
            NSURL *url = [item valueForAttribute:NSMetadataItemURLKey];
            MyDocument *doc = [[MyDocument alloc] initWithFileURL:url];
    
    if([filename isEqualToString:@"iCloudPictures"])
            {
                [doc openWithCompletionHandler:^(BOOL success) {
                    if (success) {
                        NSLog(@"Pictures : Success to open from iCloud");
                        NSData *file = [NSData dataWithContentsOfURL:url];
    
                        NSString *documentsDirectory = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0];
                        NSString *zipFolder = [documentsDirectory stringByAppendingPathComponent:@"Pics.zip"];
                        [[NSFileManager defaultManager] createFileAtPath:zipFolder contents:file attributes:nil];
                        //NSLog(@"zipFilePath : %@",zipFolder);
    
                        NSString *outputFolder = [documentsDirectory stringByAppendingPathComponent:@"Pictures"];//iCloudPics
                        ZipArchive* za = [[ZipArchive alloc] init];
                        if( [za UnzipOpenFile: zipFolder] ) {
                            if( [za UnzipFileTo:outputFolder overWrite:YES] != NO ) {
                                NSLog(@"Pics : unzip successfully");
                              }
                            [za UnzipCloseFile];
                        }
                        [za release];
    
    
                        NSError *err;
                        NSArray *files = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:outputFolder error:&err];
                        if (files == nil) {
                            NSLog(@"EMPTY Folder: %@",outputFolder);
                        }
                        // Add all sbzs to a list    
                        for (NSString *file in files) {
                            //if ([file.pathExtension compare:@".jpeg" options:NSCaseInsensitiveSearch] == NSOrderedSame) {        
                            NSLog(@" Pictures %@",file);
    
                            //                            NSFileManager *fm = [NSFileManager defaultManager];
                            //                            NSDictionary *attributes = [fm fileAttributesAtPath:[NSString stringWithFormat:@"%@/%@",documentsDirectory,file]                                                                 traverseLink:NO];
                            //                            
                            //                            NSNumber* fileSize = [attributes objectForKey:NSFileSize];
                            //                            int e = [fileSize intValue]; //Size in bytes
                            //                            NSLog(@"%@__%d",file,e);           
                        }
    
                    }
                    else 
                    {
                        NSLog(@"Pictures : failed to open from iCloud");
                        [self hideProcessingView];
                    }
                }]; 
            }
    }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is it possible to upload a user file and pass its content to a
is it possible to upload files to web page and then access file data
I have found a great silverlight upload control here: http://silverlightuploader.codeplex.com/ If a zip file
Is it possible to upload file types like .psd, .eps, .zip, .txt, and so
Is it possible to upload a specific part of the file rather than the
Is it possible to upload a file to another server or pass a file
is it possible to upload a file and subsequently when receiving response download the
Is it possible to upload an audio file (i.e. mp3, flac...) to the the
Possible Duplicate: how to upload a audio file from iphone documents folder to server
I want to implement a multi file upload I was thinking if its possible

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.