dbTalk Databases Forums  

Determining the size of a file via a URL

comp.databases.ms-access comp.databases.ms-access


Discuss Determining the size of a file via a URL in the comp.databases.ms-access forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Jozef
 
Posts: n/a

Default Determining the size of a file via a URL - 06-10-2005 , 11:02 AM






Hello,

I'd like to determine the size of a file via a URL. I'm not even sure how
to do this on the local machine, let alone a URL. Any help would be greatly
appreciated.

Thanks!




Reply With Quote
  #2  
Old   
john@miesoftware.com
 
Posts: n/a

Default Re: Determining the size of a file via a URL - 06-10-2005 , 07:54 PM






Not sure about via a URL but in VBA you can retrieve size with the
FileLen function. E.g.

SizeInBytes = FileLen(Pathname)


Reply With Quote
  #3  
Old   
rkc
 
Posts: n/a

Default Re: Determining the size of a file via a URL - 06-10-2005 , 09:13 PM



Jozef wrote:

Quote:
I'd like to determine the size of a file via a URL. I'm not even sure how
to do this on the local machine, let alone a URL. Any help would be greatly
appreciated.
If you mean you want to know the size of the source file of a web page
you can send request for the http headers only via a Microsoft.XMLHTTP
object and check the value for Content-Length.

In a nutshell:

Dim msXML As Object
Set msXML = CreateObject("Microsoft.XMLHTTP")
msXML.Open "HEAD", url, False
msXML.send
Debug.Print msXML.getResponseHeader("Content-Length")
Set msXML = Nothing


Reply With Quote
  #4  
Old   
Jozef
 
Posts: n/a

Default Re: Determining the size of a file via a URL - 06-10-2005 , 10:15 PM



Excellent! Thanks for your help, that works very well!


"rkc" <rkc (AT) rochester (DOT) yabba.dabba.do.rr.bomb> wrote

Quote:
Jozef wrote:

I'd like to determine the size of a file via a URL. I'm not even sure
how
to do this on the local machine, let alone a URL. Any help would be
greatly
appreciated.

If you mean you want to know the size of the source file of a web page
you can send request for the http headers only via a Microsoft.XMLHTTP
object and check the value for Content-Length.

In a nutshell:

Dim msXML As Object
Set msXML = CreateObject("Microsoft.XMLHTTP")
msXML.Open "HEAD", url, False
msXML.send
Debug.Print msXML.getResponseHeader("Content-Length")
Set msXML = Nothing



Reply With Quote
  #5  
Old   
karl@q2q.us
 
Posts: n/a

Default Re: Determining the size of a file via a URL - 07-01-2005 , 04:21 PM



I can't get the following code to run. I have MSXML 4.0 installed but I
can't find a Type library to Reference so when I key in something like
msXML. nothing pops up as a valid choice to enter after the dot.

Do I need something other than MSXML 4.0 and what Name should I look
for when setting the Reference to a Type library?

I'm using A2003

Quote:
Dim msXML As Object
Set msXML = CreateObject("Microsoft.XMLHTTP")
msXML.Open "HEAD", url, False
msXML.send
Debug.Print msXML.getResponseHeader("Content-Length")
Set msXML = Nothing


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.