Does anyone know a good way to get the PhysicalPath to a file with UnifiedFileSystem?
I'm using a shared upload folder on a load balanced system.
I can use file.Parent.Configuration.CustomSettings("PhysicalPath") but thats only giving me the root and not the subfolder Images.
img = "/upload/Images/pic.jpg";
UnifiedFile file = UnifiedFileSystem.GetFile(img);
path = file?????
I dont know if this will help you or not. Its from the book:
foreach (EPiServer.FileSystem.Handler.HandlerConfiguration HandlerConfig in EPiServer.FileSystem.UnifiedFileSystem.Configuration.Handlers)
{
System.Collections.IDictionaryEnumerator FsConfigSetting = HandlerConfig.CustomSettings.GetEnumerator();
while (FsConfigSetting.MoveNext())
{
Label1.Text += FsConfigSetting.Key + "\t" + FsConfigSetting.Value + " ";
}
Label1.Text += HandlerConfig.FS.GetRootDirectory().Name + " ";
Label1.Text += HandlerConfig.IsVirtualShare + " ";
Label1.Text += HandlerConfig.VirtualName + " ";
}
page 263
From this you can get the PhysicalPath regardless of file system... hope it helps!
Just remember that there might not be any physical path. With an Unified File System, the files could be stored anywhere (like in a database). Depending on the file system implementation.
/Steve
img = "/upload/Images/pic.jpg"; UnifiedFile file = UnifiedFileSystem.GetFile(img); path = file?????