Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6946257
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T13:32:30+00:00 2026-05-27T13:32:30+00:00

Problem: When i ftp upload only one file at a time, the files are

  • 0

Problem: When i ftp upload only one file at a time, the files are uploaded fine, But when i use multiple Background workers to upload files to ftp server i get exception:

  • ex {“The remote server returned an error: (550) File unavailable
    (e.g., file not found, no access).”} System.Exception
    {System.Net.WebException}

And only Some of the files get uploaded. I am pretty sure the file exits at that location, infact in another run the file it was complaining about that does not exist is downloaded but the error shifts on another file.

Code Description:
In below code i am downloading a file from one ftp server and putting it on another. This code is inside a BackgroundsWorker_DoWork Method. Background Workers are being created inside a loop.

void imageDownloadWorker_DoWork(object sender, DoWorkEventArgs e)
        {
           string[] ftpInfo = (string[])e.Argument;
            try
            {

                ///////////////////////////Downloading///////////////////////////////////////
                string uri = String.Format("ftp://{0}/{1}/images/{2}", ftpInfo[1], ftpInfo[2], ftpInfo[5]);

            FtpWebRequest request = (FtpWebRequest)WebRequest.Create(uri);
            request.Method = WebRequestMethods.Ftp.DownloadFile;
            request.UseBinary = true;
            request.Credentials = new NetworkCredential(ftpInfo[3], ftpInfo[4]);

            FtpWebResponse response = (FtpWebResponse)request.GetResponse();
            Stream ftpStream = response.GetResponseStream();

            long cl = response.ContentLength;
            int bufferSize = 4096;
            int readCount = 0;
            byte[] buffer = new byte[bufferSize];
            MemoryStream memStream = new MemoryStream();
            readCount = ftpStream.Read(buffer, 0, bufferSize);
            while (readCount > 0)
            {
                memStream.Write(buffer, 0, readCount);
                readCount = ftpStream.Read(buffer, 0, bufferSize);
            }
            response.Close();
            ///////////////////////////Uploading///////////////////////////////////////
            string uri1 = String.Format("ftp://{0}/{1}/{2}", "127.0.0.1", string.Empty, ftpInfo[5]);
            FtpWebRequest request1 = (FtpWebRequest)WebRequest.Create(uri1);
            request1.Credentials = new NetworkCredential("user", "password");
            request1.KeepAlive = false;
            request1.Method = WebRequestMethods.Ftp.UploadFile;
            request1.UseBinary = true;
            request1.ContentLength = memStream.Length;
            int buffLength = 4096;
            byte[] buff = new byte[buffLength];
            int contentLen;

            // Stream to which the file to be upload is written
            Stream strm = request1.GetRequestStream();
            memStream.Seek(0, SeekOrigin.Begin);
            contentLen = memStream.Read(buff, 0, buffLength);
            // Till Stream content ends
            while (contentLen != 0)
            {
                // Write Content from the file stream to the FTP Upload Stream
                strm.Write(buff, 0, contentLen);
                contentLen = memStream.Read(buff, 0, buffLength);
            }

            // Close the file stream and the Request Stream
            strm.Close();
            ftpStream.Close();
            memStream.Close();

        }
        catch(Exception ex)
        {
            MessageBox.Show("While Downloading File " + ftpInfo[5] + " " + ex.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            e.Result = null;
            return;
        }

Related Thread

Edit:
In File Zilla Server there is an option General Settings>Perfomance Settings>Number of Threads i have set that to 20 it didnt make any difference.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T13:32:31+00:00Added an answer on May 27, 2026 at 1:32 pm

    There maybe nothing wrong with your code. That error is a Permissions error.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have very strange problem when I upload files to my FTP (zip or
Some servers only support ftp to upload files. When I export the a project
I'm developing small FTP upload app. for mac (10.6 if it matters) Have problem
Problem: I have two spreadsheets that each serve different purposes but contain one particular
I'm having a problem here trying to upload a file with powershell. What I'm
i have refer Android FTP Library for implement ftp upload file fundamental in android
I had a problem when trying to connect and upload a file to an
I have a bash script to upload some files to my webserver. The problem
One of the FTP accounts that I use recently began requiring secure FTP connections,
...i own two domains ftp://mydomain.foo and ftp://uploads.mydomain.foo Users are able to upload zip files

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.