开发者

How Can I Get Remote FileName on Host When download it via ASIHttpRequest

How Can I Get Remote FileName on Host When download it via ASIHttpRequest??

for example, some url like this:

http://www.filedropper.com/processing/filedownload.php?id=test_22

test_22 is my filename, but original string is @"test_22.gif" , i can not analysis the filename extension from url.

i am trying to get responseString for the real filename when ASIHttpRequest call it delegate method :

- (void)request:(ASIHTTPRequest *)request
    di开发者_开发知识库dReceiveResponseHeaders:(NSDictionary *)responseHeaders

but i got nothing useful.

any idea?


i hope, you can get file name through the following code..see the link to find file type.after finding append it..

 NSString *url = @"http://www.filedropper.com/processing/filedownload.php?id=test_22";
 NSArray *parts = [url componentsSeparatedByString:@"="];
 NSString *filename = [parts objectAtIndex:[parts count]-1]; // or NSString *filename = [parts lastObject]; 
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜