string _siteUrl = "http://localhost";

                using (SPSite _site = new SPSite(_siteUrl))
                {
                    using (SPWeb _web = _site.OpenWeb())
                    {
                        SPFolder _folder = _web.Folders["<Document Library Name>"];
                        _web.AllowUnsafeUpdates = true;
                        _folder.Files.Add("Contoso Final Document + "." + extension, bytes);
                    }
                }