FCKEDITOR + JSPSMART implementation file upload (original)

xiaoxiao2021-03-06  109

Fckeditor is a very good online editor, which encompavizes all the features of all online editors now, and the implementation of the function is quite perfect, and the function button can be freely customizable, support the configuration installation in multiple locale, now http: //sourceforge.net/ The latest version is 2.2, the program interface, the function is more improved relative to version 2.0, but the function is not fully implemented, now I use or 2.0 version, my fckeditor is configured in the JSP environment The configuration is configured by taglib, the configuration interface is as follows:

After talking about some of the questions, go back to the topic of the article (FCKEDITOR JSPSMART implementation file upload), Fckeditor itself has file upload components, of course, relatively powerful JSPSmart will be inferior, because of this, only germination of JSPSMART replacement The idea of ​​some uploading components, the following is the detailed implementation process: 1. Install JSPSMART and debugged! 2. Modify the /fcked/jsp/upload.jsp file, modify the code as follows (Declaration: Upload folder as / fckeditor / fileManager / upload / jsp / upload / upload): <% @ Page ContentType = "Text / html; charSet = GB2312 "Language =" java "import =" com.jspsmart.upload. * "%> <% @ page import = "java.text.SIMPLEDATEFORMAT"%> <% @ Page Import = "java.util. *"%> <% java.util.date mydate = new java.util.date (); SimpleDateFormat formatter = new SimpleDateFormat ( "yyyyMMddHHmmss"); String mDate = formatter.format (myDate); try {mySmartUpload.initialize (pageContext); mySmartUpload.setAllowedFilesList ( "jpg, gif, jpeg, txt, doc, pdf, png") ; mySmartUpload.setTotalMaxFileSize (300000); mySmartUpload.upload (); com.jspsmart.upload.File myFile = mySmartUpload.getFiles () getFile (0);. if (! myFile.isMissing ()) {myFile.saveAs ( "/ Fckeditor / fileManager / upload / jsp / upload / " mdate ". " Myfile.getfileExt ()); string sfileurl =" / local / fckeditor / filemanager / upload / jsp / upload / " MDATE ". " ". " ". myfile.getfileext () " ";%>