The reason why its freezing is because you are doing uploading on the same thread as the GUI or main thread.
You could create a worker thread to handle the working of the uploading so the GUI doesn't lock while processing the upload.
Example:
private void uploadButton_Click(object sender, EventArgs e)
{
object[] params = new object[] { "your file what ever type this is a generic example"};
Thread uploadThread = new Thread(new ParameterizedThreadStart(processUpload));
uploadThread.IsBackground = true;
uploadThread.Start(params);
}
private void processUpload(object params){
// do upload logic here
object[] _params = (object[])params;
string s = _params[0].ToString();
}
Passing information from one form to another is straight forward, but this form will also result in a lock while processing. If that's what you want to do then just create a constructor to take a param for whatever you'd like to pass. Then call it accordingly.
private string something = null;
public MySecondForm(string Something){
this.something = Something;
MessageBox.Show(this.something);
}
// Call this in the parent form
MySecondForm mySecondForm = new MySecondForm("hello world");
mySecondForm.Show();