I am trying to save an image to the users computer when they press a button. So far, I have constructed the URL like so:
NSString *baseURL = @"http://url/";
NSString *username = [txtUsername stringValue];
NSString *userImage = [username stringByAppendingString:@".png"];
NSString *userURL = [baseURL stringByAppendingString:userImage];
From here, I need to be able to download the linked file to the users computer. Is there a way to open a “save as” dialog when the button is clicked and then dowload the linked file to the specified save location?
If not, is there a way to save the linked file to the desktop of the users computer?
[Note: you mentioned ‘users computer’ but you tagged as ‘osx’ – osx doesn’t provide frameworks for saving nor opening files under user direction. So, for Mac OS X…]
Look into NSSavePanel to allow the user to select a Mac OS X file location to save the file.
Look into NSURLDownload for downloading data from a NSURLRequest into a file.