Jeesite ckfinder mac/linux File upload path settings

Source: Internet
Author: User

Background:

If you are using a UNIX system such as Mac or Ubuntu, you must know that the UNIX system file path delimiter is / and the Windows System file delimiter is \

When you set the jeesite.properties in the

userfiles.basedir= D\:\\workspace\\jeesite

If not set, the upload path will be: dir = servletcontextfactory.getservletcontext (). Getrealpath ("/");

If you are using the Windows operating system, the future program will also be deployed on the Windows operating system, you can see here, stop, interested students can continue.

Thinkgen, this guy wrote a Ckfinder configuration class.

com . Thinkgem . Jeesite . Common . Web . Ckfinderconfig

Inherited the

com . Ckfinder . connector . Configuration . Configuration

To complete the configuration of the entire project by jeesite.properties a configuration file. It's really a comprehensive consideration. But here's the problem.

If you configure an absolute UNIX path here: For example,/user/jeesite will be converted to the relative path of the user/jeesite.

Say so much about how to solve the whole problem, then?

1. Find:

com . Thinkgem . Jeesite . Common . Utils . Fileutils.java

Modify the Path method: Add 15-17 lines and finish.

2. Test your program.

1 /**2 * fix path, replace \ \ or/etc with File.separator3      * @paramPath4      * @return5      */6      Public Staticstring Path (string path) {7String p = stringutils.replace (path, "\ \", "/");8p = stringutils.join (Stringutils.split (P, "/"), "/");9         if(! Stringutils.startswithany (P, "/") && Stringutils.startswithany (path, "\ \", "/")){Tenp + = "/"; One         } A         if(! Stringutils.endswithany (P, "/") && Stringutils.endswithany (path, "\ \", "/")){ -p = p + "/"; -         }if (Path.startswith ("/")) {p = "/" + p;17} -         returnp; +}

Jeesite ckfinder mac/linux File upload path settings

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.