TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
abburi chowdary
NA
60
15k
How to upload files and encrypt in FTP server
May 7 2018 10:40 PM
I have written below code to copy file from local system to ftp server , similarly i need to select multiple files and upload them in server . While i upload the files it should be converted as encrypted files, any suggestions, i have written code for encryption also.
public
class
WebRequestGetExample
{
public
static
void
Main ()
{
// Get the object used to communicate with the server.
FtpWebRequest request = (FtpWebRequest)WebRequest.Create(
"ftp://192.1....../ftp.txt"
); request.Method =WebRequestMethods.Ftp.UploadFile;
// This example assumes the FTP site uses anonymous logon.
request.Credentials =
new
NetworkCredential(
"username"
,
"password"
);
// Copy the contents of the file to the request stream.
byte
[] fileContents;
using
(StreamReader sourceStream =
new
StreamReader(
"E:\\Anusha\\ftp.txt"
))
{
fileContents = Encoding.UTF8.GetBytes(sourceStream.ReadToEnd());
}
request.ContentLength = fileContents.Length;
using
(Stream requestStream = request.GetRequestStream())
{
requestStream.Write(fileContents, 0, fileContents.Length);
}
using
(FtpWebResponse response = (FtpWebResponse)request.GetResponse())
{
Console.WriteLine(
"Upload File Complete, status {0}"
, response.StatusDescription);
}
}
}
Reply
Answers (
0
)
rediret user on different website
How to compress video file using c#