【发布时间】:2012-04-04 22:15:08
【问题描述】:
我需要简单地将一个字符串作为 txt 上传到我的 ftp 服务器,我搜索得很好,但没有任何效果。有没有简单地将字符串上传到 ftp 服务器? 注意:我查看了 s7ftp 的东西 simpleftp 和苹果的 ftp 东西,我无法得到任何工作。
提前致谢。
【问题讨论】:
我需要简单地将一个字符串作为 txt 上传到我的 ftp 服务器,我搜索得很好,但没有任何效果。有没有简单地将字符串上传到 ftp 服务器? 注意:我查看了 s7ftp 的东西 simpleftp 和苹果的 ftp 东西,我无法得到任何工作。
提前致谢。
【问题讨论】:
你能创建一个服务器端脚本来解析一个 POST/GET 字符串吗?对于您可以在 3 行服务器端执行的操作,似乎上传文件可能需要大量繁重的工作/编码。只是一个想法。
编辑添加
这里有一些简单的 Objective-C 供你参考:
// Create the request.
NSURLRequest *theRequest=[NSURLRequest requestWithURL:[NSURL URLWithString:@"http://www.YOURDOMAIN.com/?string=YOURSTRINGORWHATEVER"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:60.0];
// create the connection with the request
// and start loading the data
NSURLConnection *theConnection=[[NSURLConnection alloc] initWithRequest:theRequest delegate:self];
if (theConnection) {
// Create the NSMutableData to hold the received data.
// receivedData is an instance variable declared elsewhere.
receivedData = [[NSMutableData data] retain];
} else {
// Inform the user that the connection failed.
}
Click here for more info on URL Loading
如果您无法使用 ARC 或遇到问题,请尝试此课程。很方便:
希望这会有所帮助。
【讨论】: