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
Umut Zerman
NA
10
1.1k
Uploading a File into NAS
Sep 17 2018 2:03 PM
Hi there,
i've got a problem to Upload a File to a Nas.. I'm a newbie from Germany.
So the Upload is creating the File i want to, but with 0KB.
Here is my code:
var client =
new
SftpClient(
"x.x.x.x"
, 22,
"xxx"
,
"xxx"
);
client.Connect();
client.BufferSize = 1024;
Console.WriteLine(
"Verbindung wird hergestellt"
);
if
(client.IsConnected)
{
Console.WriteLine(
"Verbindung hergestellt"
);
var fileStream =
new
FileStream(uploadfile, FileMode.OpenOrCreate);
Console.WriteLine(
"Stream erstellt"
);
if
(fileStream !=
null
)
{
//Pc Nummer die die Datei empfängt ist i
for
(var i = 1; i < 25; i++)
{
Console.WriteLine(
"Stream gestartet"
);
string
pcnummer =
""
;
if
(i < 10)
{ pcnummer =
"0"
+ i.ToString(); }
else
{
pcnummer = i.ToString();
}
pcnummer = raum + pcnummer;
client.UploadFile(fileStream,
"/share/"
+ pcnummer +
"/"
+ f.Name,
null
);
// Ich habs mal mit der Zeile versucht.. aber ohne Erfolg
//client.ChangePermissions("/share/" + pcnummer + "/" + f.Name, 777);
Console.WriteLine(
"Dateien für "
+ pcnummer +
" hochgeladen"
);
}
client.Dispose();
Console.WriteLine(
"Dateien für alle hochgeladen "
);
MessageBox.Show(
"Dateien für alle hochgeladen "
);
//client.UploadFile(fileStream, "/share/" + f.Name, null);
}
}
so what do you think is my fault?
Reply
Answers (
0
)
Query from an internal network
How to Get Instagram Videos automatically for my Website