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 6108179
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T14:16:07+00:00 2026-05-23T14:16:07+00:00

Currently using SSZipArchive method to download the zip file and unzip at Documents directory

  • 0

Currently using SSZipArchive method to download the zip file and unzip at Documents directory folder. I am downloading the zip file name from URL and currently unaware of the file name because it changes each time there are any updates. How can I retrieve the file name when I receive my data ?

- (void)viewDidLoad {
   fileManager = [NSFileManager defaultManager];

   NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
   directoryPath = [paths objectAtIndex:0];
   filePath = [NSString stringWithFormat:@"%@/ZipFiles.zip", directoryPath];

    NSURL *url=[NSURL URLWithString:@"http://www.abc.com/test/test.cfc?id=123"];

    NSMutableURLRequest *request = [[[NSMutableURLRequest alloc] init] autorelease];
    [request setURL:url];
   [request setHTTPMethod:@"POST"];
[request setValue:@"application/x-www-form-urlencoded" forHTTPHeaderField:@"Content-Type"];

NSError *error;
NSURLResponse *response;
NSData *urlData=[NSURLConnection sendSynchronousRequest:request returningResponse:&response error:&error];

[fileManager createFileAtPath:filePath contents:urlData attributes:nil];
[SSZipArchive unzipFileAtPath:filePath toDestination:directoryPath];

 NSString *responseString = [[NSString alloc] initWithData:urlData encoding:NSASCIIStringEncoding];


 ///***Answer to my own question for future needs****//
  NSString *fileName = [response suggestedFilename];

}
  • 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-05-23T14:16:08+00:00Added an answer on May 23, 2026 at 2:16 pm

    NSURLResponse has a method - (NSString *)suggestedFilename which will attempt to get the file name in this order.

    1. A filename specified using the content disposition header.
    2. The last path component of the URL.
    3. The host of the URL.

    The content disposition header would be the best solution so make sure that the server sets it.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Currently using the HTTPServletRequest class and specifically the .getQueryString method to retrieve an inputted
Our team is currently using some ported code from an old architecture to a
I'm currently using exif_read_data to load the information from JPG, JPEG, TIFF and TIF
Im currently using PHP to fetch results from a mysql db. Im also displaying
Im currently using C# to pass some objects to powershell and executing a method
Currently using cocos2d. I have a plist data name myplist.plist. Inside the plist are
I'm currently using the following command in bash to list the info from an
I am currently using the contains method belonging to the ArrayList class for making
Im currently using a method that looks like the following code to add script
I am currently using javax.imageio.ImageIO to write a PNG file. I would like to

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.