简体   繁体   English

在ios中,当图像名称未知时如何从ftp下载图像

[英]How to download a image from ftp when a image name is unknown ,in ios

I am working on downloading a image from ftp ,where my ftp contains multiple images with different names generated every time in a folder.I just need to download a image whose name contains thumbs.jpg in it.我正在从 ftp 下载图像,其中我的 ftp 包含每次在文件夹中生成的具有不同名称的多个图像。我只需要下载名称中包含 thumbs.jpg 的图像。 For ex i have 4 images with names例如,我有 4 张带有名称的图像

2342345232thumbs.jpg 
453455345334snap.jpg,
4534532356pic.jpg,
1240897387trim.jpg 

from which i want to download a image name which contains thumbs.jpg .我想从中下载包含thumbs.jpg的图像名称。

how can i achieve this .please suggest我怎样才能做到这一点。请提出建议

Assuming you get the contents of the directory or atleast can retrieve the filenames, you could try string matching using NSRange range = [imageName rangeOfString:@"thumbs.jpg"]; if (range.location != NSNotFound) // found match假设您获取目录的内容或至少可以检索文件名,您可以尝试使用NSRange range = [imageName rangeOfString:@"thumbs.jpg"]; if (range.location != NSNotFound) // found match字符串匹配NSRange range = [imageName rangeOfString:@"thumbs.jpg"]; if (range.location != NSNotFound) // found match NSRange range = [imageName rangeOfString:@"thumbs.jpg"]; if (range.location != NSNotFound) // found match and then download that particular image.HTH. NSRange range = [imageName rangeOfString:@"thumbs.jpg"]; if (range.location != NSNotFound) // found match ,然后下载该特定图像。HTH。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM