📜 ⬆️ ⬇️

.Net connector for elFinder file manager

There is such a great, as it seems to me, file manager for the web called elFinder , which also integrates with the WYSIWYG editor elRTE .

But, unfortunately, I could not use it, because I have projects on ASP.Net / ASP.Net MVC, and the so-called "Connectors" (that is, the server side) were written in PHP and Python. There was an idea to write my own, but the terms were burning, and I used CKFinder. And then suddenly on this long weekend I didn’t want to climb out of the house at all ... and here’s the result — a connector that I (and you) can use in my own applications. Unless, of course, not afraid.)

Installation and Setup



I suggest you go to elfinderconnectornet.codeplex.com and download a test solution there. It consists of two projects: Test.Web (actually, our web application) and ElFinder.Connector (actually, the connector). Naturally, you can simply add reference to the ElFinder.Connector.dll library in your project.
')
Congratulations! You have almost done everything! It remains only to add something to Web.config (all this, of course, is in Test.Web).

1. Add a handler that will pull elFinder

< httpHandlers > <br> ...<br> < add verb ="*" path ="*.connector" type ="ElFinder.Connector.Connector" /> <br> </ httpHandlers > <br><br> * This source code was highlighted with Source Code Highlighter .

We are interested in the last line. From it you should understand that the URL of the connector is extremely simple: everything that ends in .connector

2. Add the handler of the configuration section

< section name ="ElFinder" <br> type ="ElFinder.Connector.Configuration.ElFinderSection" <br> allowDefinition ="Everywhere" <br> allowExeDefinition ="MachineToApplication" <br> restartOnExternalChanges ="true" /> <br><br> * This source code was highlighted with Source Code Highlighter .


3. Add the section itself

< ElFinder uplMaxSize ="10" dotFiles ="true" > <br> < Root Url ="http://localhost:55599/files" Path ="~/files" /> <br> < DisabledCommands > <br> < add Name ="duplicate" /> <br> </ DisabledCommands > <br> < DisabledMimeTypes > <br> < add Name ="application/exe" /> <br> < add Name ="application/x-msdownload" /> <br> </ DisabledMimeTypes > <br> </ ElFinder > <br><br> * This source code was highlighted with Source Code Highlighter .


Here, in general, that's all. Next you create the fayder itself, something like this

<script type= "text/javascript" charset= "utf-8" ><br> $( document ).ready( function () {<br> $( '#finder' ).elfinder({<br> url: 'test.connector' ,<br> lang: 'ru' <br> });<br> });<br> </script> <br><br> * This source code was highlighted with Source Code Highlighter .


... and it works.

In fact, not everything works. No tumbnails and resize images, editing text files (in progress). All files and folders are available for writing / reading / deleting (to be honest, I simply did not find an easy way to check permissions in .Net). Something has not been completed yet, but I will either finish it myself, or ... the code is open.)

Use on health!

UPD. 1 Naturally, do not forget to configure security (enable read / write / delete as desired by IIS_IUSRS or IUSR) for the folder in which all the obscenity will occur.

UPD. 2 .Net Framework 3.5

UPD. 3 It turned out that in nature there is one more dotnet connector, but its author did not have time to tell about it. Perhaps we will join forces, which will only benefit!

Source: https://habr.com/ru/post/107684/


All Articles