private void UploadImages() { new System.Threading.Thread(() => { Console.WriteLine("Intro========== " + imageCaptions.Count); FtpManager ftpManger = new FtpManager(); ListingManager listingManager = new ListingManager(); ftpManger.OnProgressChange += ftpManger_OnProgressChange; Hashing hashing = new Hashing(); List <string> urls = new List <string>(); List <string> links = new List <string>(); numberOfImages = localFilePaths.Count(); foreach (string localFile in localFilePaths) { numberToUpload++; string fileHash = hashing.HashFile(localFile); string extension = System.IO.Path.GetExtension(localFile); urls.Add(webDir + fileHash + extension); links.Add(linkDir + fileHash + extension); } for (int i = 0; i < numberOfImages; i++) { LoadImage(localFilePaths[i]); Console.WriteLine("Pregame========== " + imageCaptions.Count); UpdateProgress(numberToUpload, i + 1); ftpManger.UploadFile(localFilePaths[i], urls[i]); listingManager.AddListingImage(propertyID, links[i], imageCaptions[i]); } CloseForm(); }).Start(); }