private MFile CreateMFile(HtmlInputFile input, string path) { MFile f = new MFile(); f.Name = Path.GetFileName(input.PostedFile.FileName); f.Path = path; f.ReadFileFromStream(input.PostedFile.InputStream); //read file bytes if (!string.IsNullOrEmpty(custom_fields.Value)) { f.Attribs = new Hashtable(); string[] fields = custom_fields.Value.Split(new char[] { ',' }); if (fields.Length >= 1) f.Attribs.Add(fields[0].Substring(0, fields[0].LastIndexOf("|")), tbxCustomField1.Value); if (fields.Length >= 2) f.Attribs.Add(fields[1].Substring(0, fields[1].LastIndexOf("|")), tbxCustomField2.Value); if (fields.Length >= 3) f.Attribs.Add(fields[2].Substring(0, fields[2].LastIndexOf("|")), tbxCustomField3.Value); } return f; }