15,884,472 members
Sign in
Sign in
Email
Password
Forgot your password?
Sign in with
home
articles
Browse Topics
>
Latest Articles
Top Articles
Posting/Update Guidelines
Article Help Forum
Submit an article or tip
Import GitHub Project
Import your Blog
quick answers
Q&A
Ask a Question
View Unanswered Questions
View All Questions
View C# questions
View C++ questions
View Javascript questions
View Visual Basic questions
View Python questions
discussions
forums
CodeProject.AI Server
All Message Boards...
Application Lifecycle
>
Running a Business
Sales / Marketing
Collaboration / Beta Testing
Work Issues
Design and Architecture
Artificial Intelligence
ASP.NET
JavaScript
Internet of Things
C / C++ / MFC
>
ATL / WTL / STL
Managed C++/CLI
C#
Free Tools
Objective-C and Swift
Database
Hardware & Devices
>
System Admin
Hosting and Servers
Java
Linux Programming
Python
.NET (Core and Framework)
Android
iOS
Mobile
WPF
Visual Basic
Web Development
Site Bugs / Suggestions
Spam and Abuse Watch
features
features
Competitions
News
The Insider Newsletter
The Daily Build Newsletter
Newsletter archive
Surveys
CodeProject Stuff
community
lounge
Who's Who
Most Valuable Professionals
The Lounge
The CodeProject Blog
Where I Am: Member Photos
The Insider News
The Weird & The Wonderful
help
?
What is 'CodeProject'?
General FAQ
Ask a Question
Bugs and Suggestions
Article Help Forum
About Us
Search within:
Articles
Quick Answers
Messages
Comments by abhilash yelmelwar (Top 8 by date)
abhilash yelmelwar
22-Oct-12 7:59am
View
It's Just Incrementing the Next value...But I need Separate Increment for A1,A2,A3 By selecting Max value
abhilash yelmelwar
7-Aug-12 4:54am
View
ohk...i will try...thank you..
abhilash yelmelwar
6-Aug-12 1:33am
View
no dude my connection was ok...but my downloading is stopped suddenly with out any message
abhilash yelmelwar
6-Aug-12 1:32am
View
im not using any sessions here...
abhilash yelmelwar
6-Aug-12 1:31am
View
hello dave....this is my code..i tihnk we can download rest files using time and date but im not able download files...
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Windows.Forms;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Net;
using System.IO;
namespace Support
{
public partial class FTP : Form
{
public FTP()
{
InitializeComponent();
}
string filetime = @"E:\FTP photos.txt";
private void Download(string line)
{
FtpWebRequest reqFTP;
try
{
string filepath = @"E:\FTP photos";
//F:\Studentphotos
FileStream outputStream = new FileStream(filepath + "\\" + line, FileMode.Create);
reqFTP = (FtpWebRequest)FtpWebRequest.Create(new Uri("ftp://" + txtip.Text + "/" + txtupload.Text + "/" + line));
//string str = System.IO.Directory.GetFiles(filepath).ToString();
//System.IO.DirectoryInfo dir = new System.IO.DirectoryInfo(filepath);
//if (File.Exists(filepath + "//" + line))
//string str = File.Exists(filepath).ToString();
System.IO.File.Exists(line);
File.Exists(line);
//if(line==str)
// {
if (File.Exists(filepath))
{
GetFileList();
}
else
{
reqFTP.Method = WebRequestMethods.Ftp.DownloadFile;
reqFTP.UseBinary = true;
reqFTP.Credentials = new NetworkCredential(txtuser.Text, txtpass.Text);
FtpWebResponse response = (FtpWebResponse)reqFTP.GetResponse();
Stream ftpStream = response.GetResponseStream();
long cl = response.ContentLength;
int bufferSize = 2048;
int readCount;
byte[] buffer = new byte[bufferSize];
readCount = ftpStream.Read(buffer, 0, bufferSize);
while (readCount > 0)
{
outputStream.Write(buffer, 0, readCount);
readCount = ftpStream.Read(buffer, 0, bufferSize);
}
ftpStream.Close();
outputStream.Close();
response.Close();
// MessageBox.Show("Download Completed");
}
}
//}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
private void Download1(string filePath, string fileName)
{
FtpWebRequest reqFTP;
try
{
//filePath = <<The full path where the file is to be created.>>,
//fileName = <<Name of the file to be created(Need not be the name of the file on FTP server).>>
FileStream outputStream = new FileStream(filePath + "\\" + fileName, FileMode.Create);
reqFTP = (FtpWebRequest)FtpWebRequest.Create(new Uri("ftp://" + txtip.Text + "/" + txtupload.Text));
reqFTP.Method = WebRequestMethods.Ftp.DownloadFile;
reqFTP.UseBinary = true;
reqFTP.Credentials = new NetworkCredential(txtuser.Text,txtpass.Text);
FtpWebResponse response = (FtpWebResponse)reqFTP.GetResponse();
Stream ftpStream = response.GetResponseStream();
long cl = response.ContentLength;
int bufferSize = 2048;
int readCount;
byte[] buffer = new byte[bufferSize];
readCount = ftpStream.Read(buffer, 0, bufferSize);
while (readCount > 0)
abhilash yelmelwar
6-Aug-12 1:29am
View
hello dave.....
this is my code how can i download rest files from ftp...
i hav 1 solution with using time and date...but still im not able to download all files...
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Windows.Forms;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Net;
using System.IO;
namespace Support
{
public partial class FTP : Form
{
public FTP()
{
InitializeComponent();
}
string filetime = @"E:\FTP photos.txt";
private void Download(string line)
{
FtpWebRequest reqFTP;
try
{
string filepath = @"E:\FTP photos";
//F:\Studentphotos
FileStream outputStream = new FileStream(filepath + "\\" + line, FileMode.Create);
reqFTP = (FtpWebRequest)FtpWebRequest.Create(new Uri("ftp://" + txtip.Text + "/" + txtupload.Text + "/" + line));
//string str = System.IO.Directory.GetFiles(filepath).ToString();
//System.IO.DirectoryInfo dir = new System.IO.DirectoryInfo(filepath);
//if (File.Exists(filepath + "//" + line))
//string str = File.Exists(filepath).ToString();
System.IO.File.Exists(line);
File.Exists(line);
//if(line==str)
// {
if (File.Exists(filepath))
{
GetFileList();
}
else
{
reqFTP.Method = WebRequestMethods.Ftp.DownloadFile;
reqFTP.UseBinary = true;
reqFTP.Credentials = new NetworkCredential(txtuser.Text, txtpass.Text);
FtpWebResponse response = (FtpWebResponse)reqFTP.GetResponse();
Stream ftpStream = response.GetResponseStream();
long cl = response.ContentLength;
int bufferSize = 2048;
int readCount;
byte[] buffer = new byte[bufferSize];
readCount = ftpStream.Read(buffer, 0, bufferSize);
while (readCount > 0)
{
outputStream.Write(buffer, 0, readCount);
readCount = ftpStream.Read(buffer, 0, bufferSize);
}
ftpStream.Close();
outputStream.Close();
response.Close();
// MessageBox.Show("Download Completed");
}
}
//}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
private void Download1(string filePath, string fileName)
{
FtpWebRequest reqFTP;
try
{
//filePath = <<The full path where the file is to be created.>>,
//fileName = <<Name of the file to be created(Need not be the name of the file on FTP server).>>
FileStream outputStream = new FileStream(filePath + "\\" + fileName, FileMode.Create);
reqFTP = (FtpWebRequest)FtpWebRequest.Create(new Uri("ftp://" + txtip.Text + "/" + txtupload.Text));
reqFTP.Method = WebRequestMethods.Ftp.DownloadFile;
reqFTP.UseBinary = true;
reqFTP.Credentials = new NetworkCredential(txtuser.Text,txtpass.Text);
FtpWebResponse response = (FtpWebResponse)reqFTP.GetResponse();
Stream ftpStream = response.GetResponseStream();
long cl = response.ContentLength;
int bufferSize = 2048;
int readCount;
byte[] buffer = new byte[bufferSize];
readCount = ftpStream.Read(buffer, 0, bufferSize);
abhilash yelmelwar
17-Jul-12 1:59am
View
yes im agree with u...we can download updated file using time
can u pls give me example?? or any link...
abhilash yelmelwar
17-Jul-12 1:55am
View
i want to download multiple files from ftp server to local folder....
FtpWebRequest reqFTP;
try
{
//filePath = <<The full path where the file is to be created.>>,
//fileName = <<Name of the file to be created(Need not be the name of the file on FTP server).>>
FileStream outputStream = new FileStream(filePath + "\\" + fileName, FileMode.Create);
reqFTP = (FtpWebRequest)FtpWebRequest.Create(new Uri("ftp://" + txtip + "/" + fileName));
reqFTP.Method = WebRequestMethods.Ftp.DownloadFile;
//reqFTP.Method = WebRequestMethods.Ftp.ListDirectory;
reqFTP.UseBinary = true;
reqFTP.Credentials = new NetworkCredential(txtuser.Text.ToString(), txtpass.Text.ToString());
FtpWebResponse response = (FtpWebResponse)reqFTP.GetResponse();
Stream ftpStream = response.GetResponseStream();
long cl = response.ContentLength;
int bufferSize = 2097151;
int readCount;
byte[] buffer = new byte[bufferSize];
readCount = ftpStream.Read(buffer, 0, bufferSize);
while (readCount > 0)
{
outputStream.Write(buffer, 0, readCount);
readCount = ftpStream.Read(buffer, 0, bufferSize);
}
ftpStream.Close();
outputStream.Close();
response.Close();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
private void button1_Click(object sender, EventArgs e)
{
FolderBrowserDialog fldDlg = new FolderBrowserDialog();
if (txtupload.Text.Trim().Length > 0)
{
if (fldDlg.ShowDialog() == DialogResult.OK)
{
Download(fldDlg.SelectedPath, txtupload.Text.Trim());
}
}
else
{
MessageBox.Show("Please enter the File name to download");
}
}
i tried with the above code but only single file is downloading i need to download multiple files....
Show More