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

Save a zip file locally?

I dunno how save a file locally! How can I copy a file
(http://foo.com/foo.zip) to my local server
(http://mydomain.com/temp/foo.zip)?

I saw a sample in MS Quick Start but I can't manipulate it to work with for
example zip files.

WebRequest req = WebRequest.Create(txbFile.Text);

try {
WebResponse result = req.GetResponse();
Stream ReceiveStream = result.GetResponseStream();
if(true) {
StreamWriter writer = new StreamWriter(ResolvePath("temp.zip"));

Byte[] read = new Byte[512];
int bytes = ReceiveStream.Read(read, 0, 512);

// int i = ReceiveStream.ReadByte();
while (bytes > 0) {
writer.Write(bytes);
bytes = ReceiveStream.Read(read, 0, 512);
}
// while(i != -1){
// writer.Write(i);
// i = ReceiveStream.ReadByte();
// }
writer.Close();
lblResult.ForeColor = Color.Black;
lblResult.Text = "Operation Succeed!";
btnShow.Text = "Download File!";
btnShow.Enabled = true;
}
} catch(Exception _ex) {
lblResult.Text = _ex.ToString();
}

TIA
- Michael Rogers
Nov 17 '05 #1
0 1707

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

Similar topics

8
by: kieran | last post by:
Hi, I want to download an image from the web and save it locally. I have spent all day messing about with this and am still no where. We have a firewall so i use the below code. I know it...
4
by: sunilj20 | last post by:
Hello, I have a requirement wherein, a user clicks on a file name in an ASP.NET web application, and the file should automatically be downloaded (Without showing the "Open", "Save As") in the...
2
by: standish22 | last post by:
want to open a word document stored in my database. What I do is save the document locally, and then open a new winform that has the WebBrowser Control on it and navigate to that new file. ...
4
by: Matt | last post by:
Hi, I would like to save a file locally (on the client computer) in an ASP.net application. It is like the server would return some data that the user can save to a file on his local PC. The ASP...
0
by: Matt Schwartz | last post by:
I have a ASP.NET web application written using VB.NET. I have a data grid, that is sent to the browser as an excel document using the following code Private Sub CreateXLS(ByVal xdatagrid As...
4
by: teeBull | last post by:
Hi all, We'd like to take advantage of code we already have for transforming XML into HTML (using XSLT) for our users to save the HTML as an MS Word document locally. I've dug around and found...
2
by: Adam | last post by:
On one site I'm working on I occasionally get an error where instead of executing the PHP file as per normal, the browser sees the page as a file (therefore opens up a execute/save pop-up). All...
6
by: greg_e | last post by:
Is there a way to create a form in a local html file where the contents of the form are written to a local file when a 'save' button is selected? It would be nice if it was as easy as changing...
5
by: Arch Stanton | last post by:
I have a set of ASPX pages that work fine on my home computer (Vista), and on a server at work (XP). I just got a new laptop at work (XP) and these same files don't work on it. I installed IIS and...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

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.