JSP modify FCKeditor upload picture path absolute path modification __js

Source: Internet
Author: User

What we're talking about here is the modification of the absolute path. If you need the relative path, you just need to change the value of <param-value>UserFiles/</param-value>.

FCKeditor JSP support in general, to configure a large pile, online are similar articles, it is no longer mentioned, how to modify the path of uploading files, but there has been no solution, looking for a half-day, finally only their own whined whined change

Because the FCKeditor default upload path is its own engineering environment,/userfiles, is configured in Web.xml

<init-param> <param-name>baseDir</param-name> <param-value>userfiles/</param-value > * Here's one less/</init-param>

There's no way to change it to an absolute path, so just go to the servlet and find the class Connectorservlet

The parameters obtained in the Init method are not regulated, mainly in the Doget ()

String Currentpath=basedir+typestr+currentfolderstr;
String Currentdirpath = Getservletcontext (). Getrealpath (Currentpath);

This is the original writing to take the current project webcontent under the/userfiles/

Here, change it into

String Currentpath=basedir+typestr+currentfolderstr;
Currentpath=currentpath.replace ('//', '/');
String currentdirpath= "You need to store the absolute path of the file" +currentpath;

such as String currentdirpath= "d:/dweb_box/" +currentpath; * There's one more/

The following should be changed to the original wording as follows

Node Root=createcommonxml (Document,commandstr,typestr,currentfolderstr,request.getcontextpath () +currentPath);

Here, change it into

Node Root=createcommonxml (DOCUMENT,COMMANDSTR,TYPESTR,CURRENTFOLDERSTR, "You need to store files for the relative path of the Tomcat application" +currentpath);

such as Node Root=createcommonxml (document,commandstr,typestr,currentfolderstr, "/dweb_box/" +currentpath);

* and TOMC application of the path= "/dweb_box" correspondence

Currentpath and Currentdirpath in DoPost () method are consistent with Doget

There's only so much to be changed in the servlet.

Look, if you can't see it after uploading the file, it's probably your location. The path to the file is not configured for Tomcat application

As the above example

<context displayname= "Dweb_box" docbase= "D:/dweb_box" path= "/dweb_box" >
</Context>

Please leave a message for me if you have any questions or omissions.

Related Article

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.