The few lines of code shown below will enable you to use the WEB file management function.
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%@ taglib prefix="efw" uri="efw" %>
<!DOCTYPE HTML>
<HTML>
<HEAD>
<efw:Client lang="jp"/>
</HEAD>
<BODY>
<efw:elFinder home=""/>
</BODY>
</HTML>
The screen image is explore style. Drag-and-drop file uploads, uploading and downloading multiple files and folders, right-click menus, etc. are quite vivid.
Background
elFinder is a fairly famous file management tool. It is created with JavaScript and php. Click here for the Motoie website.
If you want to use it in Java, you need to create a connector. efw customized the elFinder JavaScript library, added connectors, and packaged it in a jar file in the form of jsp tags. It is one of the "3rd party connectors" on the elFinder orignal site.
Get Jar
It can be downloaded from maven.
<dependency>
<groupId>io.github.efwgrp</groupId>
<artifactId>efw</artifactId>
<version>4.07.029</version>
</dependency>
For jdk15 or higher, related jars are required.
<dependency>
<groupId>org.openjdk.nashorn</groupId>
<artifactId>nashorn-core</artifactId>
<version>15.6</version>
</dependency>
efw's elFinder tag
Usage is simple. The minimal way to write it is as described above. The home attribute is a relative path to the WEB-INF/efw/storage folder of the web application. If you want to use an absolute path, set the isAbs attribute to true.
<!--相対パス->
<efw:elFinder home="upload"/>
<!--絶対パス-->
<efw:elFinder home="C:\Windows\Microsoft.NET\Framework64" isAbs="true"/>
If you delete a file from elFinder, it will really disappear, so please be careful.
known limitations
I would like to explain some of the limitations that I know from my experience with actual projects.
Upload file capacity
Like GigaFile, we have implemented unlimited upload file size. However, since it is not published only through Tomcat, there are often restrictions depending on the deployment environment.
File count limit
I haven't yet come up with specific numbers for this, but if there are a large number of files in one folder, it will not be possible to keep up with the size and an error will occur. For example, when I home the c:\windows folder, an error occurs. In the case of the original elFinder, the error is avoided by stopping obtaining the folder size.
If there are tens of thousands of files directly under one folder, it is assumed that the JSON data needed to display them will become huge and memory overflow will occur.
Explanation
For details of the API, see the link below.
https://github.com/efwGrp/efw4.X/blob/master/help/tag.elfinder.md
The main attributes and methods are absolute/relative paths, protection, home folder settings, and read-only flag switching. Without absolute path protection, it is extremely dangerous on the Internet. Assuming a simple hack of browser console JavaScript execution, if you find ".." in the home folder name, it is an error. Also, in protected mode, setting the home folder and read-only flag causes an error.
Preview feature introduction
Select a file and press the space bar or the preview icon to bring up the preview screen. You can preview images, PDFs, Office files, etc.
The extension is required for Office file preview.
The above evidence program can be obtained from the link below.