It is possible to upload a document or file programmatically into SharePoint Document Library using C# code. You can use the followinn method to do the same:

/// <summary>
/// Programmatically upload document or file into SharePoint Document Library 
/// </summary>
void UploadDocument()
{        
    //ctrlFileUpload is ASP.Net FileUpload control.
    if (!string.IsNullOrEmpty(ctrlFileUpload.FileName))
    {
        SPWeb web = SPContext.Current.Web;

        web.AllowUnsafeUpdates = true;

        SPDocumentLibrary docLib = web.Lists["DocumentLibraryName"] as SPDocumentLibrary;

        byte[] fileBytes = ctrlFileUpload.FileBytes;

        string strDestUrl = docLib.RootFolder.Url + "/" + ctrlFileUpload.FileName;

        SPFile destFile = docLib.RootFolder.Files.Add(strDestUrl, fileBytes, true);

        destFile.Update();

        web.Update();

        web.AllowUnsafeUpdates = false;
    }
}