473,670 Members | 2,661 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 3049
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**********@g mail.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...@yaho o.NoSpamMaam.co mwrote:
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.comht tp://www.blogmetafin der.com

"jehugalea...@g mail.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
3861
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 after the file is uploaded to server which wastes the bandwidth so what i want to check is that the server first checks the size of file to upload and if it is o.k. then and then only the file will be uploaded..
2
2430
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 impersonating the domain user account and downloading the file, It seems the impersonate is got success, but its not download the file. Its simply downloading some junk pdf file instead of original file.
2
2284
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
2490
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 required by it are rather large, and most of them have email accounts with filesize limits. What I want to do is upload the files they'll need to my webpage and then have the program itself check to see if the files are present in the directories (I...
2
13371
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); sw.Close(); } catch (IOException) {
2
2361
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 know how Thank you, ps. I am really having a hard time using the "datalist" tool in ASP.NET platform, too.
15
3058
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 case, I don't want to attempt to write to it, just abort. Thanks, Brian
1
1678
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 been created on the server.once created then user can download that file. i am able to download file but the problem is that when user apply sorting to data and then save data in excel sheet. the file on the server contains the data in the same...
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 like you're on Windows... Regards, Chris -- Follow the path of the Iguana...
0
8468
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8901
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8591
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
5683
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4209
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4390
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2799
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 we have to send another system
2
2041
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1792
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.