| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 905 人关注过本帖
标题:[求助]上传图片问题(用jspsmart).
只看楼主 加入收藏
billyppppp
Rank: 1
等 级:新手上路
帖 子:5
专家分:4
注 册:2006-3-9
收藏
 问题点数:0 回复次数:0 
[求助]上传图片问题(用jspsmart).

我的java是这样写的
import java.io.*;
import java.awt.Image;
import java.awt.image.*;
import com.sun.image.codec.jpeg.*;
import java.sql.*;
import java.util.*;
import org.apache.commons.fileupload.*;
import org.apache.commons.fileupload.disk.*;
import com.jspsmart.upload.*;
import javax.servlet.jsp.PageContext;

public class UploadPic{

public boolean upload(PageContext pageContext) {

SmartUpload mySmartUpload = new SmartUpload();
long file_size_max = 4000000;
String fileName2 = "", ext = "", testvar = "";
try {
mySmartUpload.initialize(pageContext);
mySmartUpload.setAllowedFilesList("jpg,gif");
mySmartUpload.upload();
}
catch (Exception e){
System.out.println("只允许上传.jpg和.gif类型图片文件");
}
//com.jspsmart.upload.File
com.jspsmart.upload.File myFile = mySmartUpload.getFiles().getFile(0);
if (myFile.isMissing()) {
System.out.println("没有文件");
return false;
}
//String myFileName=myFile.getFileName(); //取得上载的文件的文件名
ext = myFile.getFileExt(); //取得后缀名
int file_size = myFile.getSize(); //取得文件的大小
String saveurl = "";
if (file_size < file_size_max) {
//更改文件名,取得当前上传时间的毫秒数值

try{
myFile.saveAs("/upload/sample.tmp", mySmartUpload.SAVE_PHYSICAL);
}catch(Exception e1){
System.out.println("不能保存");
}

}
else {
System.out.println("上传文件大小不能超过" + (file_size_max / 1000) + "K");
}
return true;
}
}

编译能通过 tomcat 也不报错,但在页面显示
HTTP Status 500 -

--------------------------------------------------------------------------------

type Exception report

message

description The server encountered an internal error () that prevented it from fulfilling this request.

exception

javax.servlet.ServletException: com/jspsmart/upload/SmartUpload (Unsupported major.minor version 49.0)
org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:825)
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:758)
org.apache.jsp.inventory.receive_jsp._jspService(receive_jsp.java:135)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
com.pfc.filter.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:122)


root cause

java.lang.UnsupportedClassVersionError: com/jspsmart/upload/SmartUpload (Unsupported major.minor version 49.0)
java.lang.ClassLoader.defineClass0(Native Method)
java.lang.ClassLoader.defineClass(ClassLoader.java:537)
java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123)
org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:1634)
org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:860)
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1307)
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1189)
java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302)
com.pfc.inventory.UploadPic.upload(UploadPic.java:20)
org.apache.jsp.inventory.receive_jsp._jspService(receive_jsp.java:120)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
com.pfc.filter.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:122)


note The full stack trace of the root cause is available in the Apache Tomcat/5.0.28 logs.


求各位给看看

搜索更多相关主题的帖子: import jspsmart java commons awt 
2007-07-05 09:34
快速回复:[求助]上传图片问题(用jspsmart).
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.028778 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved