Hi sljm12,

you can't retrieve the file size. If you're lucky, the server sends
a Content-Length header. Otherwise, there's no way to get it in
advance.

sljm12 <[EMAIL PROTECTED]> wrote on 13.11.2006 07:47:47:

> Hi thanks for the reply, i am talking abt cases where certain forum 
> software hide the under the URL e.g http://someserver.com/a.php?121 
> where u can't tell the filename but it redirects to lets say a.jpg.

Disable "follow redirects". Handle the redirect in your application.
Use the last part of the redirect URL as the filename.

hope that helps,
  Roland

> --- Ìì²ÅºüÀê <[EMAIL PROTECTED]> wrote:
> 
> > Hi 
> > 
> >    You can read the the Reponse Header("Content-Length") value. its
> > repsonse stream length. When you download file, then it's file size.
> > 
> > The filename is your request filename. For example  i request
> > 'http://www.ddf.com/download.exe' then brower would render
> > download.exe ...(M)
> > 
> > ----- Original Message ----- 
> > From: "sljm12" <[EMAIL PROTECTED]>
> > To: <[email protected]>
> > Sent: Monday, November 13, 2006 2:06 PM
> > Subject: retreving file size and file name 
> > 
> > 
> > > Hi all, have 2 questions.
> > > 
> > > Some background, I am writing a simple downloader that uses
> > regular expressions to download files from a forum.
> > > 
> > > 1. How do i retrieve the file size of the file that i am
> > downloading?
> > > 
> > > 2. The forum uses php, and the link to the files are usually
> > something like
> > "http://www.insertservername.com/attachment.php?123013"; using a web
> > browser for downloads the brower is able to know the resultant file
> > name, how do i do that in HttpClient?
> > > 
> > > Pretty new to HttpClient and will appreciate any help.
> > > 
> > > Regards
> > > Stephen
> > > 
> > >
> > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail:
> > [EMAIL PROTECTED]
> > > For additional commands, e-mail:
> > [EMAIL PROTECTED]
> > > 
> > >
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to