Forum Moderators: coopster & phranque

Message Too Old, No Replies

LWP::UserAgent and Content-Disposition:

LWP::UserAgent and Content-Disposition:

         

affter333

10:05 am on Oct 30, 2004 (gmt 0)



Hi:
I'm using LWP::UserAgent to retrieve
attachments from yahoo mail. since yahoomail
uses cgi to output attachments, the http response
contains something like:

Content-Disposition: attachment; filename="test.jpg"

the question is, I can succesfully retrieve the data,
but I don't know how to extract filename in http response,
does anybody know how to do this?

Thanks for your kind help...

jollymcfats

4:38 pm on Oct 30, 2004 (gmt 0)

10+ Year Member



You can access the response headers on the HTTP::Response object. (The same one you're calling ->content() on to get the body of the attachment.)

You can do something like this to extract the filename:

my($filename) = ($r->header('Content-Disposition') =~ m/"([^"]+)"/); 

affter333

4:33 am on Oct 31, 2004 (gmt 0)



thanks, I use proxomitron to monitor http reqs
it's a great tool..

[proxomitron.info...]

Proxomitron: a free, highly flexible, user-configurable, small but very powerful, local HTTP web-filtering proxy.