473,511 Members | 15,715 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Check Size of Web File Before Downloading it?

Hello:

Is it possible to request the size of a file given a URL?

I would like to ignore files less than a user-specified value, but I
don't think I should have to download it first, just to find out. Any
help?

Thanks,
Travis
Nov 24 '07 #1
3 3045
Well, the response *may* give you a content-length header, but it may
simply stream, in which case you cannot tell.
Nov 24 '07 #2
You can try the HEAD verb. It only retrieves the headers, which may include
the content-length. Here's some detail:
http://www.eggheadcafe.com/tutorials...ead-reque.aspx

--Peter
"Inside every large program, there is a small program trying to get out."
http://www.eggheadcafe.com
http://petesbloggerama.blogspot.com
http://www.blogmetafinder.com

"je**********@gmail.com" wrote:
Hello:

Is it possible to request the size of a file given a URL?

I would like to ignore files less than a user-specified value, but I
don't think I should have to download it first, just to find out. Any
help?

Thanks,
Travis
Nov 24 '07 #3
On Nov 24, 4:15 pm, Peter Bromberg [C# MVP]
<pbromb...@yahoo.NoSpamMaam.comwrote:
You can try the HEAD verb. It only retrieves the headers, which may include
the content-length. Here's some detail:http://www.eggheadcafe.com/tutorials...1c-4dd8-9129-f...

--Peter
"Inside every large program, there is a small program trying to get out."http://www.eggheadcafe.comhttp://petesbloggerama.blogspot.comhttp://www.blogmetafinder.com

"jehugalea...@gmail.com" wrote:
Hello:
Is it possible to request the size of a file given a URL?
I would like to ignore files less than a user-specified value, but I
don't think I should have to download it first, just to find out. Any
help?
Thanks,
Travis- Hide quoted text -

- Show quoted text -
Oh wow, that cuts some time down (some of the time). Thanks a lot!
Nov 25 '07 #4

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

Similar topics

2
3844
by: vishal | last post by:
hi is there anyway that i can check the size of file on client side before uploading file to server???? suppose the user uploads file of 10 mb then the server will know the size is 10 mb...
2
2417
by: Bala | last post by:
Hi I am trying to download the PDF files from my webserver using ASP.Net. All my files are stored at F Drive on webserver. Like this F:\Main Folder\Sub Folder\Files\File1.pdf I am...
2
2277
by: yonthebeach | last post by:
hi, i have an upload mechanism on my website and want to check the filesize on the client size. is this possible? thanks yavuz bogazci
7
2478
by: Steve | last post by:
Hello, I am a beginner/intermediate c++ coder. I have a program that I am writing and would like to be able to distribute to some of my friends. The problem with this is that the data files...
2
13324
by: Kimmo Laine | last post by:
Hi! Is there a way to check if file is already open/used by another process? I know that i can do something like this to check it try { StreamWriter sw = new StreamWriter(filename);...
2
2358
by: amanzour | last post by:
How can I check the file extension of let say a file extension in the client machine? I am using ASP.NET C# language, and was hoping one of the field validators could take care of my q. but don't...
15
3044
by: Brian Simmons | last post by:
Is there an easy way to check to see if a file is in use? I want to open a CSV file from my .NET2 program, and write to it. However, the file could be in use by another program. If that is the...
1
1668
by: Muddasir | last post by:
Hello everyone. I am facing problem in downloading .xls file. I generate report and save data in excel sheet on server. and once user click the 'save data in excel format', an excel sheet is...
0
193
by: Chris Rebert | last post by:
On Sat, Sep 27, 2008 at 2:43 PM, A. Joseph <joefazee@gmail.comwrote: Well, if you're on unix, you could run the 'file' command and check its output using the 'subprocess' module, but it sounds...
0
7251
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7148
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...
1
7089
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7517
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
3230
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3217
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1581
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
790
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
451
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.