开发者

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

开发者 https://www.devze.com 2023-02-26 23:52 出处:网络
How Can I Get Remote FileName on Host When download it via ASIHttpRequest?? for example, some url like this:

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

精彩评论

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