Quantcast
Channel: sshnet Discussions Rss Feed
Viewing all articles
Browse latest Browse all 1729

New Post: Upload limit

$
0
0
Is there any limit to upload files by
SftpClient client.UploadFile(FileStream, string newPath) method?

Because my program always stopped when reach 1024/XXXX files (label6.Text)
where XXXX is count of files ready to upload and displaying proper value
try { 
            
            string filesFrom = @"PATH_WITH_PDF_FILES";
            string filesTo = @"DESTINATION_PATH";

            string[] filePaths = Directory.GetFiles(filesFrom, "*.pdf");
            int filesUploaded = 0;

            foreach (string plik in filePaths) {
                string newfile=filesTo+plik.Substring(plik.LastIndexOf("\\")+1);

                FileStream ms = new FileStream(filesFrom + plik.Substring(plik.LastIndexOf("\\") + 1), FileMode.OpenOrCreate, System.IO.FileAccess.ReadWrite);
                ms.Position = 0;

                mySFTPClient.UploadFile(ms, newfile);

                
                try
                {
                    mySFTPClient.OpenRead(newfile);
                    filesUploaded++;
                    label6.Text = "files:\n" + filesUploaded + "/" + filePaths.Count();
                }
                catch { 
                }

            
            }
            
            MessageBox.Show("DONE");
}
catch
{
            string tresc = "Connected ?";
            MessageBox.Show(tresc);
}

Viewing all articles
Browse latest Browse all 1729

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>