SaaS CMS has officially launched! Learn more now.

Getting the physical path of files in FileManager

Vote:
 

Hi,

I have 300+ images uploaded in FileManager.

Now I need to get the physical path representation of those images in my code-behind.

How would I do it? The structure of the VPP folder is not the same as the folder structure in FileManager

 

Thanks.

 

#51604
Jun 17, 2011 1:36
Vote:
 

Maybe not much help, but check out the sdk at sdk.episerver.com. There you will find a developer's guide which talks about the file system. 

But basically you get the file like this:

System.Web.Hosting.HostingEnvironment.VirtualPathProvider.GetFile(path)

And the physical structure is because you are using the versioning provider. It stores the files as guids and uses the guids three first pairs for folder structure. So the file 77E21AEE-9895-11E0-9B8A-206F4824019B.jpg will be stored in the folder stucture: 77/E2/21/. Hope that makes sense, otherwise I do believe that the sdk talks about this. 

#51605
Jun 17, 2011 5:55
Vote:
 

you can get it as follows

UnifiedFile uf = HostingEnvironment.VirtualPathProvider.GetFile(virtualPath) as UnifiedFile;
string localPhotoPath = uf.LocalPath;

    

make sure you import

using EPiServer.Web.Hosting;

    

#51637
Edited, Jun 17, 2011 20:43
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.