LxFTPRequest * request = [LxFTPRequest uploadRequest];
request.serverURL = [[NSURL URLWithString:[delegate.ftpDict valueForKey:@"ftp_Address"]]URLByAppendingPathComponent:[NSString stringWithFormat:@"/ios%d.jpg",i]];
这样上传成功之后 默认传入的ftp文件夹在/home/shareAdmin 目录下。
而现在需要 传在/opt/share目录下。 /home 和 /opt平级。
/根目录
{
/home
{
shareAdmin
}
/opt
{
share
}
}
LxFTPRequest * request = [LxFTPRequest uploadRequest];
request.serverURL = [[NSURL URLWithString:[delegate.ftpDict valueForKey:@"ftp_Address"]]URLByAppendingPathComponent:[NSString stringWithFormat:@"/opt/share/iod%d.jpg",i]];
直接这样写上传失败 550.
请问,怎么切换文件夹目录啊。或者有什么其他的ftp上传文件的第三方么。
类似changeWorkingDirectory方法
大家讲道理2017-04-17 17:58:39
放弃了原本的正则判断。。我也看不懂啥意思。
使用的新的方法判断
(NSURL )smartURLForString:(NSString )str
{
NSURL * result;
NSString * trimmedStr;
NSRange schemeMarkerRange;
NSString * scheme;
assert(str != nil);
result = nil;
trimmedStr = [str stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]];
if ( (trimmedStr != nil) && ([trimmedStr length] != 0) ) {
schemeMarkerRange = [trimmedStr rangeOfString:@"://"];
if (schemeMarkerRange.location == NSNotFound) {
result = [NSURL URLWithString:[NSString stringWithFormat:@"ftp://%@", trimmedStr]];
} else {
scheme = [trimmedStr substringWithRange:NSMakeRange(0, schemeMarkerRange.location)];
assert(scheme != nil);
if ( ([scheme compare:@"ftp" options:NSCaseInsensitiveSearch] == NSOrderedSame) ) {
result = [NSURL URLWithString:trimmedStr];
} else {
// It looks like this is some unsupported URL scheme.
}
}
}
return result;
}
url中改为// 就可以了。多谢
toys 提示。谢谢
LxFTPRequest * request = [LxFTPRequest uploadRequest];
request.serverURL = [[NSURL URLWithString:[delegate.ftpDict valueForKey:@"ftp_Address"]]URLByAppendingPathComponent:[NSString stringWithFormat:@"///opt/share/tmp/irmds/iod%d.jpg",i]];