It works, it uploads 2 files to my FTP server...
I want to add a progress bar, is it too hard ??? It doesn't matter if it is individual stats for each file, or one for both, which ever is less code :D
Thank you so much guys.
I know there are other ways to upload more than one file, but this is the easiest way I found.
I am hoping I can add a progress bar to the existing code, rather than making fresh code... Only because this code here I am understanding well.
Thanks again !!!!
private void button4_Click(object sender, EventArgs e)
{
string FileName = "c:\\slides\\" + TB_slideid.Text + ".gif";
string FileName2 = "c:\\slides\\" + "descript2.png";
if (TB_itemid.Text != "")
{
try
{
WebRequest request = WebRequest.Create("ftp://2wheelsgonewild.com/public_html/ebay/" + TB_itemid.Text + "/");
request.Method = WebRequestMethods.Ftp.MakeDirectory;
request.Credentials = new NetworkCredential("wijjsufc", "password");
using (var resp = (FtpWebResponse)request.GetResponse()) ;
}
catch
{
MessageBox.Show(" =D Folder already exists, select a new ITEM ID ...lol" + TB_itemid.Text + " is already exists in server :D ");
}
Upload(FileName);
Upload(FileName2);
FACE_upload.Text = ": D";
FACE_upload.ForeColor = System.Drawing.Color.Green;
}
else
{
MessageBox.Show("Make sure ITEM ID is not empty. -.-''");
}
}
Iftikar HussainPosted Aug 3, 2013, 3:19 AM
Regards,
Iftikar
thiago costaPosted Aug 3, 2013, 2:20 AM
The progress bar moves but the files im uploading are kind of too small to tell.
thiago costaPosted Aug 3, 2013, 1:50 AM
The second way doesn't really encourage me. it is way too much to be even worth it..
It was really easy with DOWNLOADING from ftp.
WebClient Client = new WebClient();
Client.DownloadFileCompleted += new AsyncCompletedEventHandler(Completed);
Client.DownloadProgressChanged += new DownloadProgressChangedEventHandler(ProgressChanged);
Client.DownloadFileAsync(new Uri("http://mywebsite.com/update.zip"), "update.zip");}
//The code below, goes after the top one (different block)
private void ProgressChanged(object sender, DownloadProgressChangedEventArgs e){
progressBar1.Value = e.ProgressPercentage;}
//The code below, will do what ever happens after the file completes put code between {}
//Make sure you drag a progress bar named progressBar1
private void Completed(object sender, AsyncCompletedEventArgs e){}//what ever to do after completed
So there is no way to do the upload some way similar ?
Thanks
----EDIT----
Thanks very much for the effort, I am not too fluent, and it's a shame I gave up.
But I think I might declare myself beat by a upload progress bar for the moment lol.
Thanks again
Iftikar HussainPosted Aug 3, 2013, 1:40 AM
http://www.codeproject.com/Articles/449594/Progress-Bars-Threads-Windows-Forms-and-You
Regards,
Iftikar
thiago costaPosted Aug 3, 2013, 1:37 AM
Added the event,
Errors don't exist...
How how do I make it so, it will detect my upload ?
I uploaded the file, and it didn't move the bar.
Iftikar HussainPosted Aug 3, 2013, 1:34 AM
Regards,
Iftikar
thiago costaPosted Aug 3, 2013, 1:27 AM
Now, how to I tie it to my current upload code ?
Thanks !
I got 2 errors... they are the same saying backgroundWorker1 doesnt exist.
Thanks again
Iftikar HussainPosted Aug 3, 2013, 1:13 AM
Please refer the below link. You need to use Thread for uploading the file.
http://www.dotnetperls.com/progressbar
Regards,
Iftikar