Here is what I have tried and it doesn't seem to work. I don't get any errors, but it doesn't seem to add the file to the media library either.
using(new Sitecore.SecurityModel.SecurityDisabler())
{
if(myFileControl.HasFile)
{
MediaCreatorOptions _options = new MediaCreatorOptions();
_options.Database = Factory.GetDatabase("master");
_options.FileBased = false;
_options.IncludeExtensionInItemName = false;
_options.KeepExisting = false;
_options.Versioned = false;
_options.Destination = "/sitecore/media library";
MediaItem _newFile = MediaManager.Creator.CreateFromStream(myFileControl.FileContent, myFileControl.FileName, _options);
}
}
My biggest issue is that I don't really understand what some of the different parameters and properties do. What is the "Destination" property for the MediaCreatorOptions? Is it supposed to be just a folder? Is it supposed to have the item name also? What are the three parameters for the CreateFromStream method? The first one seems to be the Stream - I get that. But the second was says "FileName". What is this supposed to be? If I am creating from a Stream why do I need to tell Sitecore the FileName?
Any help would be appreciated.