473,394 Members | 1,701 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Determining the size of a file via a URL

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!

Nov 13 '05 #1
4 3608
Not sure about via a URL but in VBA you can retrieve size with the
FileLen function. E.g.

SizeInBytes = FileLen(Pathname)

Nov 13 '05 #2
rkc
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
Nov 13 '05 #3
Excellent! Thanks for your help, that works very well!
"rkc" <rk*@rochester.yabba.dabba.do.rr.bomb> wrote in message
news:VM***************@twister.nyroc.rr.com...
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

Nov 13 '05 #4
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

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


Nov 13 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Luca | last post by:
I have the following problem: I'm developing a system where there are some processes that communicate each other via message queues; the message one process can send to another process is as...
2
by: Phil Galey | last post by:
In VB.NET I find the IO object very handy in replacing most of the functionality of the FileSystemObject. One exception, however, is in determining the size of a file. How can you determine the...
12
by: Raja | last post by:
How to know the buffer size and increase buffer size in c++.
2
by: Phil Galey | last post by:
Using the following, you can determine the size of a file: Dim fi As New IO.FileInfo(<Path to file>) MsgBox(fi.Length) .... but what about the size of a directory? The IO.DirectoryInfo object...
14
by: googler | last post by:
Is there any C library function that returns the size of a given file? Otherwise, is there a way in which file size can be determined in a C program? I need to get this for both Linux and Windows...
2
by: Doug | last post by:
Hi, It looks like the only way to get a size of a file within dot net is to use FileInfo and the Length property. However that only returns the number of bytes in the file which is translating...
9
by: vineeth | last post by:
Hello all, I have come across a weird problem, I need to determine the amount of bytes read from a file, but couldn't figure it out , My program does this : __ file = open("somefile") data =...
13
by: writeson | last post by:
Hi all, I'm writing some code that monitors a directory for the appearance of files from a workflow. When those files appear I write a command file to a device that tells the device how to...
0
by: Cameron Simpson | last post by:
On 10Jul2008 13:20, Manuel Vazquez Acosta <mva.led@gmail.comwrote: | Cameron Simpson wrote: | On 09Jul2008 15:54, Ethan Furman <ethan@stoneleaf.uswrote: | >The solution my team has used is to...
38
Frinavale
by: Frinavale | last post by:
I'm implementing a Silverlight application that uses Sockets to receive data that is pushed to it from a Socket Server. (Silverlight only supports the TCP protocol) The Socket Server pushes a...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.