I try to imagine how that would look like in the iPhone's filesystem. When I archive some stuff, it goes maybe into the documents dir, right? Could I take that file then and send it to a server for backup purposes?
+2
A:
To get the documents folder in code, do this:
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
NSString *myDocumentFilePath = [documentsDirectory stringByAppendingPathComponent:@"fileName.ext"];
Where the documents folder is actually located is probably an implementation detail, and you shouldn't ever hard-code it.
As for uploading to a server, well, you can't access it from outside the iPhone, so you'd have to write something in your app to upload it. You can get the binary data easily:
NSData *data = [NSData dataWithContentsOfFile:myDocumentFilePath];
Uploading it is scope for another question, I imagine.
iKenndac
2009-08-14 18:31:25