I am trying to upload a Media file to EpiServer media folder. The parameters sent are the file and the path in which I want the file to be uploaded. The path may or may not be present in the CMS
[eg: Test Folder 2/Test Folder 2.2/]
If it is available I want the reference of the folder so that I can upload the file to it and if not I want all the folder in the path to be created and then get the reference of the newly created folder.
Since I am very new to EpiServer I have little knowledge about where to find the APIs and examples. Infact I tried the following :
public static UnifiedDirectory CreateDirectory(string virtualPath);
but it is giving a null value as return on following call
var dir = UnifiedDirectory.CreateDirectory("~/Global/Test Folder 2/Test Folder 2.2/");
Which EPiServer version are you using?
Shouldn't you use ContentFolder to create subdirectory for media?
Its EpiServer 7.5