The only difference when uploading files to the “Downloadable goods” library, is that you must specify the manager to use the system libraries provider. The string representation of the provider is “SystemLibrariesProvider”. Here is an example of how to get the libraries manager with this provider:
public static void UploadFileToDownloadableGoods(string fileTitle, Stream fileStream, string fileExtension)
{
string providerName = "SystemLibrariesProvider";
Guid downloadableGoodsId = new Guid("e5915e51-707e-4232-9830-68f2800067f8");
LibrariesManager librariesManager = LibrariesManager.GetManager(providerName);
//Create the document.
var document = librariesManager.CreateDocument();
//Get the downloadable goods library.
DocumentLibrary downloadableGoods = librariesManager.GetDocumentLibraries().Where(d => d.Id == downloadableGoodsId).SingleOrDefault();
//Set the library.
document.Parent = downloadableGoods;
document.Title = fileTitle;
document.DateCreated = DateTime.UtcNow;
document.PublicationDate = DateTime.UtcNow;
document.LastModified = DateTime.UtcNow;
document.UrlName = Regex.Replace(fileTitle.ToLower(), @"[^\w\-\!\$\'\(\)\=\@\d_]+", "-");
librariesManager.Upload(document, fileStream, fileExtension);
librariesManager.SaveChanges();
var bag = new Dictionary<string, string>();
bag.Add("ContentType", typeof(Telerik.Sitefinity.Libraries.Model.Document).FullName);
WorkflowManager.MessageWorkflow(document.Id, typeof(Document), null, "Publish", false, bag);
}