FileInputStream(file) 类只能上传文本和图象之类的文件,如execl等文件上传后文件被损坏,有没有能够上传所有类型文件的java类啊,另外能否解决文件中带中文上传不了的问题,神仙们帮帮忙啊

解决方案 »

  1.   

    能传图像,为什么不能传EXCEL?肯定是你的文件上传类写的不正确
      

  2.   

    传是能传上去, 但上传后的execl文件或者word文件打开失败
      

  3.   

    或提示Word无法读取此文档,文档可能已损坏...
      

  4.   

    org.apache.commons.net.ftp.ftpclient.storeFile(remoteFile,FileInputStream)  上传文本文件可以,上传execl或word文件后在上传的位置打不开
      

  5.   

    用Commons-fileuploads包,代码如下public static boolean upload(String uploadedFile,String targetFile){
    boolean tag = false;
    File upload = null;
    File target = null;
    try{
    upload = new File(uploadedFile);
    target = new File(targetFile);
    FileUtils.copyFile(upload, target);
    tag = true;
    }catch (Exception e) {
    if(Constant.DEBUG){
    e.printStackTrace();
    }
    throw new UploadException("上传失败!");
    }
    return tag;
    }