If am running nopCommerce under the IIS virtual directory (for example shop.com/nopcommerce/) the images inserted from the Roxy Fileman into the WYSIWYG editor do not contain the virtual directory which results into 404 of course.
recently I have to work with this issue and following fixes it with Roxyfileman: this is how i did it though can be refactored:
Webconfig: <add key="ImageVirtualDirectory" value="D:/temp/vdirs"/> it works differently if on network: <add key="ImageVirtualDirectory" value="////Nasserv01/shared/test"/>
conf.json: "FILES_ROOT": "~/Content/Images/uploaded", // set it to your virtual image directory
RoxyFilemanController
private string confFile = "~/Content/Roxy_Fileman/conf.json"; // if IIS has an issue with json otherwise not needed private string rootDirectory = "~/content/images/uploaded";
if (!path.StartsWith("~")) { if (!path.StartsWith("/")) path = "/" + path; path = "~" + path; } path = path.Replace("\\", "/"); if (!string.IsNullOrEmpty(ImageVirtualDirectory) && path.Contains(ImageVirtualDirectory)) { path = path.Replace(ImageVirtualDirectory, ImageVirtualDirectoryName); } if (!path.ToLowerInvariant().Contains(rootDirectory)) path = rootDirectory; return _context.Server.MapPath(path); }
protected void ListDirTree(string type) { DirectoryInfo d = new DirectoryInfo(GetFilesRoot()); if (!d.Exists) throw new Exception("Invalid files root directory. Check your configuration.");
// for network virtual path private string FixPath(string path) {
if (!path.StartsWith("~")){ if (!path.StartsWith("/")) path = "/" + path; path = "~" + path; }
path = path.Replace("\\", "/"); if (!string.IsNullOrEmpty(ImageVirtualDirectory) && path.Contains(ImageVirtualDirectory)) { path = path.Replace(ImageVirtualDirectory, ImageVirtualDirectoryName); } if (!path.ToLowerInvariant().Contains(rootDirectory)) path = rootDirectory;
return _context.Server.MapPath(path); }
protected void ListDirTree(string type) { DirectoryInfo d = new DirectoryInfo(GetFilesRoot()); if(!d.Exists) throw new Exception("Invalid files root directory. Check your configuration.");
And finally we have added support for virtual directories in the the RoxyFileman. This will be in the new 4.0 version. You can see the changes here, here, here and maybe somewhere else
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.