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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T07:56:00+00:00 2026-05-23T07:56:00+00:00

Is it possible to download a file from internet store it in document directory

  • 0

Is it possible to download a file from internet store it in document directory when an URL is given? I went through some documents in apple developer’s site. It said that its possible using NSURLDownload, but it cannot be used in iOS. So, it should be done by using NSURLConnection only in case of iOS. So, someone help me download a file(even the HTML page) from the given URL. Thanks in advance.

  • 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-23T07:56:00+00:00Added an answer on May 23, 2026 at 7:56 am

    Here’s an example of getting an image from a server and saving it to a file.

    Create your instance variables

    NSMutableData *activeDownload;
    NSURLConnection *imageConnection;
    

    Now create your connection

    NSMutableURLRequest *request = [[NSMutableURLRequest alloc] init];
    NSURL *url = [[NSURL alloc] initWithString:@"URL TO FILE"];
    [request setURL:url];
    [url release];
    url = nil;
    
    NSURLConnection *conn = [[NSURLConnection alloc] initWithRequest:request delegate:self];
    

    Handle receiving data

    - (void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data {
        [self.activeDownload appendData:data];
    }
    

    Transfer finished, save the data

    - (void)connectionDidFinishLoading:(NSURLConnection *)connection {
    NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
    NSString *fileName = [[paths objectAtIndex:0] stringByAppendingPathComponent:self.imageFileName];
    
    [self.activeDownload writeToFile:fileName atomically:YES];
    
    self.activeDownload = nil;
    self.imageConnection = nil;
    }
    

    There are other bits of the code I’ve not shown (properties, etc), but this should give you enough to help, I think.

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

Sidebar

Related Questions

I want to download a binary file from a url. Is it possible to
Is it possible to download a file from a website in Windows Application form
I need to download a text file from the internet using C#. The file
Is it possible to download a file (i.e. an sqlite database file) from the
Is it possible to download a file from my server directly to a user's
In my application I download some xml data file from some information center, add
Is it possible to let your user download a file with a different name?
is it possible to upload a file and subsequently when receiving response download the
Is it possible to download php files from the server where they are located?
I need user download JPEG file from my app, however, when user change the

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.