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
Aniket Narvankar
566
2.1k
603.2k
Upload File on SFTP Server Using Asp.Net
Mar 4 2019 7:06 AM
I want to upload File on SFTP Server,first I need to check wether there is a folder with specific name on SFTP Server,if folder exists i will save file in that folder,if not I will create it and then save it.
Following is the code I tried
using (SftpClient client = new SftpClient(host,port,username,password))
{
string path = @"export\home\MEDREPORT_UHC\UAT\";
client.Connect();
if (!client.Exists(path + "Testing"))
{
client.CreateDirectory(path + "Testing");
}
Stream fin = File.OpenRead(filePath);
client.UploadFile(fin, path + "\\" + "Testing" + "\\" + filename, true);
fin.Close();
client.Disconnect();
}
I want to create a folder name Testing on the path given is export\home\MEDREPORT_UHC\UAT\
i.e. inside UAT folder,but instead of creating folder inside UAT,it created folder with name
export\home\MEDREPORT_UHC\UAT\Testing and saves file in it.
How to do this? Kindly provide solution on this
Reply
Answers (
0
)
Invalid index -1 for this OracleParameterCollection with Cou
Help me understand some code