• 大小: 2.45MB
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2023-11-11
  • 语言: Java
  • 标签: jsp  

资源简介

一个批量上传文件的demo,能实现批量上传并显示缩略图,对每个文件实现自动命名并上传至指定路径。采用webuploader插件,自己对js和css进行了一定程度的封装。

资源截图

代码片段和文件信息

package com.config;

import com.controller.UploadController;
import com.jfinal.config.Constants;
import com.jfinal.config.Handlers;
import com.jfinal.config.Interceptors;
import com.jfinal.config.JFinalConfig;
import com.jfinal.config.Plugins;
import com.jfinal.config.Routes;
import com.jfinal.core.Const;
import com.jfinal.ext.handler.ContextPathHandler;
import com.jfinal.kit.PathKit;
import com.jfinal.render.ViewType;

public class Config extends JFinalConfig {

public final static String relativePath=“images//“+DateUtil.getCurrentDate();
public final static String filePath=PathKit.getWebRootPath()+“//“+relativePath;
@Override
public void configConstant(Constants me) {
// TODO Auto-generated method stub
me.setDevMode(true);

me.setEncoding(“utf-8“);

me.setViewType(ViewType.JSP);

me.setUploadedFileSaveDirectory(filePath);//文件上传保存路径
me.setMaxPostSize(1*Const.DEFAULT_MAX_POST_SIZE);//上传文件最大为10M
}

@Override
public void configRoute(Routes me) {
// TODO Auto-generated method stub
me.add(“/“ UploadController.class);
}

@Override
public void configPlugin(Plugins me) {
// TODO Auto-generated method stub

}

@Override
public void configInterceptor(Interceptors me) {
// TODO Auto-generated method stub

}

@Override
public void configHandler(Handlers me) {
// TODO Auto-generated method stub
me.add(new ContextPathHandler(“basePath“));
}

}

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2015-12-14 14:19  FileUpload\
     文件         875  2015-12-14 14:19  FileUpload\.classpath
     文件        1043  2015-12-14 14:19  FileUpload\.project
     目录           0  2015-12-14 14:19  FileUpload\.settings\
     文件         503  2015-12-14 14:19  FileUpload\.settings\.jsdtscope
     文件         364  2015-12-14 14:19  FileUpload\.settings\org.eclipse.jdt.core.prefs
     文件         556  2015-12-14 14:19  FileUpload\.settings\org.eclipse.wst.common.component
     文件         345  2015-12-14 14:19  FileUpload\.settings\org.eclipse.wst.common.project.facet.core.xml
     文件          49  2015-12-14 14:19  FileUpload\.settings\org.eclipse.wst.jsdt.ui.superType.container
     文件           6  2015-12-14 14:19  FileUpload\.settings\org.eclipse.wst.jsdt.ui.superType.name
     目录           0  2015-12-14 14:19  FileUpload\build\
     目录           0  2015-12-14 14:19  FileUpload\build\classes\
     目录           0  2015-12-14 14:19  FileUpload\build\classes\com\
     目录           0  2015-12-14 14:19  FileUpload\build\classes\com\config\
     文件        2334  2015-12-14 14:19  FileUpload\build\classes\com\config\Config.class
     文件        1199  2015-12-14 14:19  FileUpload\build\classes\com\config\DateUtil.class
     目录           0  2015-12-14 14:19  FileUpload\build\classes\com\controller\
     文件        2332  2015-12-14 14:19  FileUpload\build\classes\com\controller\UploadController.class
     文件         556  2015-12-14 14:19  FileUpload\build\classes\log4j.properties
     目录           0  2015-12-14 14:19  FileUpload\res\
     文件         556  2015-12-14 14:19  FileUpload\res\log4j.properties
     目录           0  2015-12-14 14:19  FileUpload\src\
     目录           0  2015-12-14 14:19  FileUpload\src\com\
     目录           0  2015-12-14 14:19  FileUpload\src\com\config\
     文件        1483  2015-12-14 14:19  FileUpload\src\com\config\Config.java
     文件        1035  2015-12-14 14:19  FileUpload\src\com\config\DateUtil.java
     目录           0  2015-12-14 14:19  FileUpload\src\com\controller\
     文件        1473  2015-12-14 14:19  FileUpload\src\com\controller\UploadController.java
     目录           0  2015-12-14 14:19  FileUpload\WebContent\
     目录           0  2015-12-14 14:19  FileUpload\WebContent\js\
     文件       16155  2015-12-14 14:19  FileUpload\WebContent\js\fileUpload.js
............此处省略65个文件信息

评论

共有 条评论