SSH项目的上传问题,求大神。
我的项目是使用ssh框架做的,里面有个上传功能,上传文件一大就会直接action里面的方法也不走,直接就返回input.我自己不知道如何设置上传的大小,求大神解答下,谢谢。下面放代码
action里面的:
// 上传文件存放路径
	private final static String UPLOADDIR = "/upload";
	// 上传文件集合
	private List<File> file;
	// 上传文件名集合
	private List<String> fileFileName;
	// 上传文件内容类型集合
	private List<String> fileContentType;
        // 上传方法
	public boolean upload(int i) {
		Map session = ActionContext.getContext().getSession();
		try {
			InputStream in = new FileInputStream(file.get(i));
			String dir = ServletActionContext.getRequest().getRealPath(
					UPLOADDIR);
			if (fileName.endsWith(".exe")) {
				return false;
			}
			File uploadFile = new File(dir, fileName);
			OutputStream out = new FileOutputStream(uploadFile);
			byte[] buffer = new byte[(int)uploadFile.length()];
			int length;
			while ((length = in.read(buffer)) > 0) {
				out.write(buffer, 0, length);
			}
			in.close();
			out.close();
		} catch (
FileNotFoundException ex) {
			System.out.println("上传失败!");
			ex.printStackTrace();
			return false;
		} catch (
IOException ex) {
			System.out.println("上传失败!");
			ex.printStackTrace();
			return false;
		}
		return true;
	}
据我的猜测是private List<File> file;这个file有文件大小的限制,文件一大就无法给其赋值,但是这个file类我也无法改。其大神给个解决方案,谢谢各位大神了。
              
------解决方案-------------------- struts.properties配置文件设置上传大小限制,如struts.multipart.maxSize=102400 。
------解决方案--------------------struts.xml
<constant name="struts.multipart.maxSize" value="2097152000" />