0

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

beryllium
  • 29,669
  • 15
  • 106
  • 125
Jeremy
  • 883
  • 1
  • 20
  • 41

2 Answers2

0

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

Community
  • 1
  • 1
Diego Torres
  • 5,308
  • 5
  • 25
  • 29
  • Thanks Diego. Reading the other posts, it looks like everyone is struggling with these libraries. There doesn't seem to be any 101 tutorials that actually show working up-and downloads to FTP site. – Jeremy May 11 '11 at 01:31
0

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.

Community
  • 1
  • 1
epatel
  • 45,805
  • 17
  • 110
  • 144
  • Hi I have tried that library too, it doesn't work. No errors, but equally no upload. I see others have had same issue. Would you mind trying it and posting code for all to see. Many thanks. – Jeremy May 11 '11 at 01:27