473,396 Members | 2,021 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,396 software developers and data experts.

Downloading Zip File from FTP Site

Hello everyone and thanks for your help in advance. I am
working on an application that allows a user to downlad a
zip file from an FTP site. I have used the following
code:

Dim URL As String = "f= "ftp://ftpsite/data.zip"

Dim outputFile As String = "C:\Data.zip"
Dim wReq As WebRequest
Dim wResp As WebResponse
Dim respStream As Stream
Dim reader As StreamReader
Dim writer As StreamWriter

' create the Web Request
wReq = WebRequest.Create(URL)

' get the response
wResp = wReq.GetResponse()
respStream = wResp.GetResponseStream()
reader = New StreamReader(respStream,
Encoding.ASCII)

' and write it to the required file
writer = New StreamWriter(outputFile)
writer.Write(reader.ReadToEnd())

However, the application fails to work. I have verified
that the FTP site is configured properly and works, so
the problem is in my code. I am not exactly sure what is
wrong. Any help would be greatly appreciated. Thanks.
Jul 19 '05 #1
1 2487
Hello Hugh,

Please refer to http://www.codeproject.com/csharp/ftpdriver1.asp for a FTP client sample on how to download a file from
FTP server. Thanks.

Best regards,
Yanhong Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.

--------------------
!Content-Class: urn:content-classes:message
!From: "Hugh McLaughlin" <hu**@kmcnetwork.com>
!Sender: "Hugh McLaughlin" <hu**@kmcnetwork.com>
!Subject: Downloading Zip File from FTP Site
!Date: Sat, 19 Jul 2003 13:29:45 -0700
!Lines: 31
!Message-ID: <00****************************@phx.gbl>
!MIME-Version: 1.0
!Content-Type: text/plain;
! charset="iso-8859-1"
!Content-Transfer-Encoding: 7bit
!X-Newsreader: Microsoft CDO for Windows 2000
!X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300
!Thread-Index: AcNONH3F+g2D7qZDRKGEHrgrhHLGfQ==
!Newsgroups: microsoft.public.dotnet.general
!Path: cpmsftngxa06.phx.gbl
!Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.general:101833
!NNTP-Posting-Host: TK2MSFTNGXA12 10.40.1.164
!X-Tomcat-NG: microsoft.public.dotnet.general
!
!Hello everyone and thanks for your help in advance. I am
!working on an application that allows a user to downlad a
!zip file from an FTP site. I have used the following
!code:
!
!Dim URL As String = "f= "ftp://ftpsite/data.zip"
!
! Dim outputFile As String = "C:\Data.zip"
! Dim wReq As WebRequest
! Dim wResp As WebResponse
! Dim respStream As Stream
! Dim reader As StreamReader
! Dim writer As StreamWriter
!
! ' create the Web Request
! wReq = WebRequest.Create(URL)
!
! ' get the response
! wResp = wReq.GetResponse()
! respStream = wResp.GetResponseStream()
! reader = New StreamReader(respStream,
!Encoding.ASCII)
!
! ' and write it to the required file
! writer = New StreamWriter(outputFile)
! writer.Write(reader.ReadToEnd())
!
!However, the application fails to work. I have verified
!that the FTP site is configured properly and works, so
!the problem is in my code. I am not exactly sure what is
!wrong. Any help would be greatly appreciated. Thanks.
!
Jul 19 '05 #2

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

Similar topics

11
by: Steven Burn | last post by:
I'm curious as I am in need of advice on how I can move a site from an old Win 2K server, to it's new home on a Win 2003 server, without having to mess around with downloading/uploading the file's...
1
by: Tom Haughton | last post by:
To make better use of my commuting time I want to download audio files from websites such as: http://freshair.npr.org/day_fa.jhtml?displayValue=day&todayDate=02/27/2004 for listening to them...
5
by: John Morgan | last post by:
I am using the following link to download a file of about 50k <a target= "_blank" href="http://www.bsecs.org.uk/ExecDocs/documentStore/elfridaWord.doc">open file</a> If I save the file to...
2
by: Hugh McLaughlin | last post by:
Hello everyone and thanks for your help in advance. I am working on an application that allows a user to downlad a zip file from an FTP site. I have used the following code: Dim URL As String...
0
by: Steven | last post by:
When a user is redirected to our app thru a _blank target hyperlink, everything seems to work fine until he downloads a file from our site. This is the code used for downloading: Dim fso As New...
3
by: xeroxero | last post by:
I would like to prevent people from downloading a .zip from a ASP.NET 2.0 web site, but still allow people to touch a .aspx page in the same directory. I also want to set things so if a user clicks...
3
by: Chuck Renner | last post by:
Please help! This MIGHT even be a bug in PHP! I'll provide version numbers and site specific information (browser, OS, and kernel versions) if others cannot reproduce this problem. I'm...
8
by: danish | last post by:
Hi, Can anyone suggest me why some .php files are downloading and some are executing. Ive got php 5.2.0 and apache 2.0.54. Apache came as an rpm along with Fedora 4. I downloaded php from the site...
6
by: cyusman | last post by:
Hi, We have just moved our application to a new webfarm server environment which utilizing hardware load balancing, SSL off-loading and HTTP compression off-loading.My application is running on...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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:
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
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
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...
0
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
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
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.