sending .txt file to ftp

2019-06-05 19:52发布

I have managed (finally) to send something (a picture) to my server. This has been a painful journey for me.

I used the Apple sample code for SimpleFTPSample and put in my server details. I now want to do this again, but this time send a text file with the contents of whatever in entered into a textField.

Can anyone help?

标签: iphone xcode ftp
1条回答
啃猪蹄的小仙女
2楼-- · 2019-06-05 20:40

Here's a FTP library that works on iPhone:

http://code.google.com/p/s7ftprequest/

The example on their web page looks straightforward:

S7FTPRequest *ftpRequest = [[S7FTPRequest alloc] initWithURL:
[NSURL URLWithString:@"ftp://192.168.1.101/"]
toUploadFile:[[NSBundle mainBundle] pathForResource:@"Info" ofType:@"plist"]];

ftpRequest.username = @"testuser";
ftpRequest.password = @"testuser";

ftpRequest.delegate = self;
ftpRequest.didFinishSelector = @selector(uploadFinished:);
ftpRequest.didFailSelector = @selector(uploadFailed:);
ftpRequest.willStartSelector = @selector(uploadWillStart:);
ftpRequest.didChangeStatusSelector = @selector(requestStatusChanged:);
ftpRequest.bytesWrittenSelector = @selector(uploadBytesWritten:);

[ftpRequest startRequest];
查看更多
登录 后发表回答