473,387 Members | 1,464 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,387 software developers and data experts.

Download tif from the web via a stream with progress indication

Hi all,

In VB6, I could use the API too query the size of a file on the web, then
download that file showing a custom progress indicator. I realize that I
can use the DownloadFile method and show a UI, but I would like to indicate
progress in my own form instead. In VB2005, how can I first get the
filesize of the web image (a tif file), then stream that image (as an array
of bytes??) to a local file while showing progress?

If all else fails, I suppose I could go the API route, but I was wondering
if there was a .Net native way to do it.

Thanks,
Lance

Sep 7 '06 #1
2 2483
On Thu, 7 Sep 2006 08:41:05 -0500, "Lance" <chuckyboy81070-at-onehotpotatoimeanhotmail.comwrote:
>Hi all,

In VB6, I could use the API too query the size of a file on the web, then
download that file showing a custom progress indicator. I realize that I
can use the DownloadFile method and show a UI, but I would like to indicate
progress in my own form instead. In VB2005, how can I first get the
filesize of the web image (a tif file), then stream that image (as an array
of bytes??) to a local file while showing progress?

If all else fails, I suppose I could go the API route, but I was wondering
if there was a .Net native way to do it.

Thanks,
Lance
Have as look at the WebClient. I use this to simply download and then display the resulting image.

'Start the download:
WebClient1.DownloadDataAsync(some uri)

'In the WebClient1_DownloadProgressChanged is the "progress value":
MyProgress = e.ProgressPercentage

'In the WebClient1_DownloadDataCompleted event:
Dim myDatabuffer As Byte() = e.Result
Dim ms As New System.IO.MemoryStream
ms.Write(myDatabuffer, 0, myDatabuffer.Length)
bm = New Bitmap(ms, True)
Dim iWidth As Integer = bm.Width
Dim iHeight As Integer = bm.Height

PictureBox1.Image = bm
Gene
Sep 7 '06 #2
Thanks Gene. I'll look into that.

Lance

"gene kelley" <ok**@by.mewrote in message
news:gp********************************@4ax.com...
On Thu, 7 Sep 2006 08:41:05 -0500, "Lance"
<chuckyboy81070-at-onehotpotatoimeanhotmail.comwrote:
>>Hi all,

In VB6, I could use the API too query the size of a file on the web, then
download that file showing a custom progress indicator. I realize that I
can use the DownloadFile method and show a UI, but I would like to
indicate
progress in my own form instead. In VB2005, how can I first get the
filesize of the web image (a tif file), then stream that image (as an
array
of bytes??) to a local file while showing progress?

If all else fails, I suppose I could go the API route, but I was wondering
if there was a .Net native way to do it.

Thanks,
Lance

Have as look at the WebClient. I use this to simply download and then
display the resulting image.

'Start the download:
WebClient1.DownloadDataAsync(some uri)

'In the WebClient1_DownloadProgressChanged is the "progress value":
MyProgress = e.ProgressPercentage

'In the WebClient1_DownloadDataCompleted event:
Dim myDatabuffer As Byte() = e.Result
Dim ms As New System.IO.MemoryStream
ms.Write(myDatabuffer, 0, myDatabuffer.Length)
bm = New Bitmap(ms, True)
Dim iWidth As Integer = bm.Width
Dim iHeight As Integer = bm.Height

PictureBox1.Image = bm
Gene
Sep 7 '06 #3

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

Similar topics

12
by: Jerry Camel | last post by:
I thought I had finally figured out how to control the downloads from my page. I was having issues with large files, but after much research I came up with the following code. The download seems to...
2
by: Steve Lloyd | last post by:
Hi, I am trying to create a popup progress box for a downloading file and then do a page redirect/transfer on completion of the download and also to confirm completion of the download, much like...
2
by: Sleepy | last post by:
I am wanting to allow a client to download a file from a web server and save it on their local PC. The only way that I have found to do this is to use HTTP headers. I am using the code shown below...
2
by: moondaddy | last post by:
I have a asp.net app where a user will need to download multiple files at once. Below is some sample code I'm using to download a single file which works perfectly, however, rather than a single...
9
by: Mark Olbert | last post by:
I have an application whose installer can be downloaded from the Internet as an MSI file (by clicking on a link). The content-type parameter is set to application/octet-stream. Under Firefox,...
4
by: Nathan Sokalski | last post by:
I want to give visitors to my site the option of downloading a generated ..txt file by clicking a button. I know how to generate text files, but how do I cause the browser to pop up one of those...
7
by: Loane Sharp | last post by:
Hi there I'm currently using WebClient.DownloadFile to download a file from the server to my local disk. Is there a way to show the progress of the file download? Best regards Loane
2
by: barthelemy.von.haller | last post by:
Hi all, I googled and read this group but could not find any solution to my problem. I have a page to download big excel files that we 'build' on the server side. When a user click on the...
10
by: =?Utf-8?B?SnVhbg==?= | last post by:
Hi! I want to use ASP to download big files using ADODB.STREAM. It works very fine with files smaller than 80 MB. On the Webserver I can see that memory allocation and the process w3wp is...
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
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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.