private string BuildUploadQuery()
        {
            string indexNames = Empty;
            string indexVals  = Empty;
            string base64     = Empty;
            bool   first      = true;

            foreach (string index in indexList)
            {
                if (indexList.First() == index)
                {
                    indexNames += index;
                }
                else
                {
                    indexNames += $"|{index}";
                }
            }

            foreach (Control c in indexTable.Controls)
            {
                if (c is TextBox && first)
                {
                    indexVals += c.Text;
                    first      = false;
                }
                else if (c is TextBox)
                {
                    indexVals += $"|{c.Text}";
                }
            }

            try
            {
                Byte[] fileBytes = File.ReadAllBytes(txtFilePath.Text);
                base64 = Convert.ToBase64String(fileBytes);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
                MessageBox.Show($"Unable to read file:\n{ex.Message}", "I/O Error");
                throw ex;
            }

            var parameters = new Dictionary <string, string>
            {
                ["ENTITYID"]           = mainForm.EntID,
                ["SESSIONID"]          = mainForm.SessionID,
                ["PARAMETERS"]         = Empty,
                ["SOURCEIP"]           = Empty,
                ["PROJID"]             = nupProjID.Value.ToString(),
                ["FIELDNAMES"]         = indexNames,
                ["FIELDVALUES"]        = indexVals,
                ["ORIGINALFILENAME"]   = Path.GetFileName(txtFilePath.Text),
                ["SAVEDFILE"]          = Empty,
                ["ORIGINALFILENAMEFT"] = Empty,
                ["SAVEDFILEFT"]        = Empty,
                ["ADDTOFOLDER"]        = Empty,
                ["INFILEDATA"]         = base64,
                ["INFILEDATAFT"]       = Empty
            };
            var query = APIHelper.BuildPVEQuery("AttachNewDocToProjectEx", parameters);

            return(query.ReplaceFirst("INFILEDATA", @"INFILEDATA types:dt=""bin.base64"" xmlns:types=""urn:schemas-microsoft-com:datatypes"""));
        }