本人正在做用jspSmartUpload上传文件,但不知道jspSmartUpload.jar该防在什么位置,该怎么用?程序编译出现这样的错误是怎么回事呢?请指教下小弟,万分的感谢!!!
An error occurred at line: 7 in the jsp file: /do_upload.jsp
Generated servlet error:
smartupload cannot be resolved to a typeAn error occurred at line: 7 in the jsp file: /do_upload.jsp
Generated servlet error:
smartupload cannot be resolved to a typeAn error occurred at line: 7 in the jsp file: /do_upload.jsp
Generated servlet error:
com.jspsmart.upload.File cannot be resolved to a typeAn error occurred at line: 7 in the jsp file: /do_upload.jsp
Generated servlet error:
myFile cannot be resolvedAn error occurred at line: 7 in the jsp file: /do_upload.jsp
Generated servlet error:
myFile cannot be resolvedAn error occurred at line: 7 in the jsp file: /do_upload.jsp
Generated servlet error:
myFile cannot be resolved
An error occurred at line: 7 in the jsp file: /do_upload.jsp
Generated servlet error:
smartupload cannot be resolved to a typeAn error occurred at line: 7 in the jsp file: /do_upload.jsp
Generated servlet error:
smartupload cannot be resolved to a typeAn error occurred at line: 7 in the jsp file: /do_upload.jsp
Generated servlet error:
com.jspsmart.upload.File cannot be resolved to a typeAn error occurred at line: 7 in the jsp file: /do_upload.jsp
Generated servlet error:
myFile cannot be resolvedAn error occurred at line: 7 in the jsp file: /do_upload.jsp
Generated servlet error:
myFile cannot be resolvedAn error occurred at line: 7 in the jsp file: /do_upload.jsp
Generated servlet error:
myFile cannot be resolved
这个你不会不知道吧
2、把它的classes文件解压出来,直接放到WEB-INF/classes/目录下
放你的工程目录下面的WEB-INF/lib
String uploadPath =sm.getEmailConfig("uploadPath");
File testdir = new File(uploadPath); //为了保证目录存在,如果没有则新建该目录
if (!testdir.exists()) {
testdir.mkdirs();
}
DiskFileUpload fu = new DiskFileUpload();
// 设置最大文件尺寸,这里是4MB
fu.setSizeMax(50194304);
// 设置缓冲区大小,这里是50kb
fu.setSizeThreshold(14096);
// 得到所有的文件:
List fileItems = fu.parseRequest(request);
FileItem file_item;
for(int i=0;i<fileItems.size();i++)
{
file_item=(FileItem)fileItems.get(i);
}
Iterator i = fileItems.iterator();
// 依次处理每一个文件:
String EmailTitle=null;
String Emailcctem=null;
List ToEmaillist=new ArrayList();
List ToCCEmail=new ArrayList();
List Urllist =new ArrayList();
while (i.hasNext()) {
FileItem fi = (FileItem) i.next();
// 检查当前的项目是普通的表单元素,还是一个上载的文件
if (fi.isFormField()) {
// 获得表单域的名字
if (fi.getFieldName().equals("QU_BJDSDEM.ReceiveEmail"))
{
String ToEmail =fi.getString();
String[] tt = st.split(ToEmail,";");
for(int j=0;j<tt.length;j++)
{
ToEmaillist.add(tt[j]);
}
// System.out.println("ToEmail is ["+ToEmail+"]");
}
if (fi.getFieldName().equals("QU_BJDSDEM.SendEmailMan"))
{
String CCEmail =fi.getString();
if(CCEmail!=null && !"".equals(CCEmail))
{
String[] cc = st.split(CCEmail,";");
for(int h=0;h<cc.length;h++)
{
ToCCEmail.add(cc[h]);
}
}else
{
ToCCEmail.add("");
}
}
if (fi.getFieldName().equals("BAS_BJDYJ.txtEmail_title"))
{
EmailTitle =fi.getString("UTF-8");
//String vl= ch.getstring(EmailTitle);
// System.out.println("EmailTitle is ["+vl+"]");
}
if (fi.getFieldName().equals("BAS_BJDYJ.txtEmail_content"))
{
Emailcctem =fi.getString("UTF-8");
// System.out.println("Emailcctem is ["+Emailcctem+"]");
}
String fieldName = fi.getFieldName();
}
// 获得文件名,这个文件名包括路径:
String fileName = fi.getName();
if (!(fileName == null)) {
// 写入文件,暂定文件名为a.txt,可以从fileName中提取文件名:
String uploadFileName = fileName.substring(fileName.trim().lastIndexOf("\\") + 1);
//File GetSizeFile= new File(uploadPath+uploadFileName);
//System.out.println(uploadPath+uploadFileName);
Urllist.add(uploadPath+uploadFileName);
/*FileSize =FileSize+GetSizeFile.length(); */
fi.write(new File(uploadPath + uploadFileName));
pathlist.add(uploadPath+uploadFileName);
}
}
if(Urllist.size()>0)
{
for(int h=0;h<Urllist.size();h++)
{
File GetSizeFile= new File(Urllist.get(h).toString());
//System.out.println(uploadPath+uploadFileName);
FileSize =FileSize+GetSizeFile.length();
}
}