使用JSP是否可以将文件上传到自己的myEclipse项目下,而不是服务器下,方便项目携带呢?smartupload能实现吗?Java本身是否可以有方法呢?

解决方案 »

  1.   

    可以指定绝对路径。我们的例子中使用的相对路径,使用的是common-fileupload,可以自己改成绝对路径试试。http://family168.com/tutorial/jsp/html/jsp-ch-11.html
      

  2.   

    smartupload可以是实现,lz可以查看帮助文档做
      

  3.   

    同意1楼,路径指向你的workspace就Ok了
      

  4.   

    用Smartupload,将路径设置到自己的myEclipse项目下
      

  5.   

    jsp Smartupload实现文件上传
    <%
    SmartUpload su=new SmartUpload();
    su.initialize(pageContext);
    su.upload();
    int count=su.save("D:\\upload");
    out.println(count+"个文件已经上传成功...<br>");
    for(int i=0;i<su.getFiles().getCount();i++){
    com.jspsmart.upload.SmartFile file=su.getFiles().getFile(i);
    if(file.isMissing())
    continue;
    out.println("第"+(i+1)+"个文件的名字是:"+file.getFileName()+"<br>");
    }
    %>