The reason why this is crapping out is one of your files being uploaded is not there. Either way without seeing more of your code i can't tell you exactly...just that the file itself is not being received. To properly get around the file upload you should do something like this
HttpFileCollection uploadedFiles = HttpContext.Current.Request.Files;
foreach(var file in uploadedFiles)
{
if (file != null)
{
if (file.ContentLength > 0)
{
System.IO.Stream fs = new FileStream(RootPath, FileMode.Create);
fs = file.InputStream;
byte[] fileData = new byte[file.ContentLength];
fs.Write(fileData, i, file.ContentLength);
file.SaveAs(RootPath + "\\" + file.FileName);
MessageBox.Show("File uploaded to Server!");
SendString("<h1>Fail edukalt üles laetud!</h1>", Client, "");
}
}
}
This will check to m ake sure the file is not null and then also check the content length is valid so it won't explode on this line
byte[] fileData = new byte[file.ContentLength];
I have no clue if the rest of your code is working as I don't have access to your hard drive/dev environment...however for the time being the snippet above would take care of your null ref exception.