2011-03-15 92 views
1

我管理(最后)发送一些东西(图片)到我的服务器。对我来说这是一个痛苦的旅程。发送.txt文件到ftp

我用苹果示例代码为SimpleFTPSample,并把我的服务器的详细信息。我现在想再次这样做,但是这次发送一个文本文件,其中包含输入到textField中的内容。

谁能帮助?

+0

如果你有一个很好的理由,用我不知道ftp(所以告诉我闭嘴,如果我是居高临下)但是...为什么不使用Web服务方法?像任何其他HTTP数据上传一样发送POST数据?确保你已经通过FTP保护自己免受恶意攻击。 – Joe 2011-03-15 14:36:11

回答

1

这里有一个FTP库,在iPhone上工作:

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

他们的网页上的例子看起来很简单:

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];