Writing file to secure server
I'm trying to write a text file to a secure server .....
-(IBAction) startUpload{
NSLog(@"Start upload");
NSString *myString = @开发者_运维技巧"TESTTEXT";
NSURL *myURL = [NSURL URLWithString:@"ftp://USERNAME:PASSWORD@72.167.1.1/testfile.plist"];
NSError *error;
BOOL ok = [myString writeToURL:myURL atomically:NO encoding:NSUTF8StringEncoding error:&error];
if (!ok) { // if NOT ok
NSLog(@"error writing to file at %@, %@, %@",myURL,[error localizedFailureReason],[error localizedDescription]);
}
}
... and all I get is this error message ....
error writing to file at ftp://USERNAME:PASSWORD@72.167.1.1/testfile.plist, (null), The operation couldn’t be completed. (Cocoa error 518.)
All help appreciated
I think FTP is not supported as NSURL,
take a look to this question: NSURL with http:// works fine but with ftp:// not
also take a look to this one
Upload photo to arbitrary FTP with iPhone app
Have a look at s7ftprequest
Description:
This project was inspired by a marvelous lib that I'm using in all my apps that involve network interactions (I can hardly remember one without any): ASIHTTPRequest.
This is the product of composing together ASIHTTPRequest design solutions and SimpleFTPSample techniques.
精彩评论