RichFilemanager icon indicating copy to clipboard operation
RichFilemanager copied to clipboard

Set user files folder path other than root directory using ashx connector

Open wilsonld opened this issue 7 years ago • 4 comments

In raising this issue, I confirm the following (please check boxes):

  • [x ] I have read and understood the Wiki. Especially deploy and configuration articles.
  • [x ] I have checked that the bug I am reporting can be replicated, or that the feature I am suggesting isn't already present.
  • [ x] I have checked the pull requests tab for existing solutions/implementations to my issue/suggestion.
  • [x ] I realise that server-side connectors are provided by various contributors. The implementations are vary due to programming language features/limitations or other factors. Thus a particular connector may not implement, or partially implement, the API features.
  • [ x] I realise that any changes in configuration options and/or plugin parameters affect the plugin behavior. I specified all the differences from defaults in details.

I use the following server-side connector (check one):

  • [ ] PHP connector by servocoder
  • [ ] Java connector by fabriceci
  • [ ] Python3 Flask connector by jsooter
  • [ ] Python3 Flask connector by stevelittlefish
  • [ ] NodeJs connector by jlaustill and forestlake
  • [ ] ASP.NET Core connector by sinanbozkus
  • [x ] ASHX connector by richeflits
  • [ ] Other (specified below)

My familiarity with the project is as follows (check one):

  • [ ] I have never used the project.
  • [ ] I have used the project briefly.
  • [x ] I have used the project extensively, but have not contributed previously.
  • [ ] I am an active contributor to the project.

This is really two issues. The first is that I apparently can't use the PHP connector on my shared hosting ISP provider due to the fact that it won't support the composer package manager. I, therefore, have to revert to a previous version of Rich Filemanager that didn't use composer for the PHP connector. I wish that Servocoder would provide an option to use a non-composer based PHP connector in new releases that could be implemented in these situations.

I, therefore, have had to revert to using another connector if I wish to use a new release of Rich Filemanager. I am attempting to use the ashx connector and it works fine (although somewhat slower than the PHP connector) but I can't, however, seem to figure out how to make it work with a file directory other than the root directory of my website. I don't want it to open with the root directory file folder that exposes all the files on my website, but rather go to the subfolder where only my uploaded images and documents are housed. The PHP connector has an option in its filemanager.php file - example: ( $local->setRoot("/FileMgrFiles/", true, true); - where I can specify the desired folder, but the ashx connector apparently does not.

I have tried to use the absolutePath and the previewURL options in the filemanager.config.jason file but they either don't work with the ashx connector or I am not using them correctly. (There were no examples shown in the Wiki on how to configure these options.)

Any help on this would be greatly appreciated.

wilsonld avatar Jun 14 '18 15:06 wilsonld

Unfortunately I can't help you with ASHX connector, you know I'm maintainer of PHP connector and the main client-side bundle. You can try to ping richeflits, since he made a big impact on ASHX connector, however stay prepared to rely on yourself.

Regarding your query I can build zip archive that will contain RFM project with all dependencies installed and composer onboard. This file can be attached to the release assets.

psolom avatar Jun 27 '18 14:06 psolom

If possible, try the ASP.Net core connector. The ashx connector needs some work as you have seen.

JoeyWasHere avatar Jul 02 '18 17:07 JoeyWasHere

Hi everybody, I seem to have addressed this with a couple modifications to the filemanager.ashx file. First, I inserted the following line 28: public string userfiledirectory = "/FileMgrFiles"; // User Directory where files are stored

Second, I modified line 61 (previously line 60 to the following: DirectoryInfo RootDirInfo = new DirectoryInfo(HttpContext.Current.Server.MapPath(path) + userfiledirectory);

It seems to work so far. Ideally, there should be a separate config file where all this information could be stored, but I'm a bit scared to bite that off. Also, the current ashx connector relies a lot on for-next loops and stringbuilder which, I think, is probably not the most efficient code, but I'm more familiar with VB code than C# so coming up with a more efficient solution is probably beyond my skill capabilities (I'm 71 years old, after all).

By the way, the asp connector is written using asp.net MVC. I'm still using Webforms and never got the hang of MVC. Simple solutions for simple minds, I guess.

wilsonld avatar Aug 20 '18 19:08 wilsonld

I spoke too soon. The code above doesn't work as it tries to insert the current path into the path and then adds the defined user folder when I try to access a subfolder. Example: /Private/FileMgrFiles rather than /FileMgrFiles/Private

wilsonld avatar Aug 21 '18 10:08 wilsonld