• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Downloading files without web browsers
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Downloading files without web browsers


  • Subject: Downloading files without web browsers
  • From: "Stuppel, Searle @ San Diego Central" <email@hidden>
  • Date: Fri, 17 Aug 2001 14:01:30 -0700

If i wanted to download a file from the web directly to the desktop/home
directory, could i use the following format? or is there a better way to do
it. I do not want to actually laucnh a web browser to do it.

NSSavePanel *sp;
int runResult;
NSString *fileContents ;

sp = [NSSavePanel savePanel];
[sp setTitle:@"Save Your Report"];
runResult = [sp runModalForDirectory:NSHomeDirectory () file:@""];

if (runResult == NSOKButton)
{
fileContents = [NSString stringWithContentsOfURL:[NSURL
URLWithString:@"http://www.sketchwork.com/blah.sit";]];
[fileContents writeToFile:[sp filename] atomically:YES];
}


Would this work? Or is there a better way (as i imagine there must be.

Maybe some form of

NSData *someData
someData = [NSString withContentsOfURL:[NSURL
URLWithString:@"http://www.sketchwork.com/blah.sit";]];
[someData writeToFile:[sp filename] atomically:YES];

(obviously i would need to find the exact command for "withContentsOfURL" if
that happens to not be the exactly right one.

Thanks for any info.

Searle

(and i am at work on a windows machine, so i making some guestimates at code
here)


  • Prev by Date: Re: tcpdump wiggin out?
  • Next by Date: Making help indexing work
  • Previous by thread: Re: tcpdump wiggin out?
  • Next by thread: Making help indexing work
  • Index(es):
    • Date
    • Thread