我想用fileupload的组件,上传图片到图片服务器,请问应该怎么写?比如说我的HTML页面在192.168.1.10这台机器上,但是我操作的时候想把图片传到192.168.1.12这台机器上,两台机器都是linux系统,而且都有密码,程序该怎样写?

解决方案 »

  1.   

    先把图片上传到服务器,也就是192.168.1.10,然后再把图片上传到192.168.1.12。。
    至于10怎么到12那就得看你自己采取什么方式了,如果是直接写文件的话,那必须给10权限,如果是12开了FTP服务器的话,直接FTP上传就OK
      

  2.   

    public ActionForward KH016_Confirm(ActionMapping mapping,
    ActionForm form, HttpServletRequest request,
    HttpServletResponse response) throws Exception {
    try
    {
    KH010Form thisForm = (KH010Form) form;
    KH010Logic KH010Logic = new KH010Logic();

    FormFile file=thisForm.getWorkhistory();

    FormFile file2 = thisForm.getProjecthistory();

    String workfile = file.getFileName();
    String projectfile = file2.getFileName(); String uploadPath = BseSystemPropertyCopy.getInstance().getProperty("updown_path")+"\\";

    if(!(new File(uploadPath).isDirectory()))
    {
    new File(uploadPath).mkdir();
    } if (!workfile.equals(""))
    {
    copy2(file,uploadPath);
    }

    if (!projectfile.equals(""))
    {
    copy2(file2,uploadPath);
    }

    KH010Logic.updateFile(thisForm, request,workfile,projectfile);

    thisForm.setCloseflg("1");
    }
    catch (Exception exp)
    {
    logger.error(exp);
    return (mapping.findForward("ERROR"));
    }

    return (mapping.findForward(KH010Constants.PAGE_KH016));
    }          public ActionForward KH016_Confirm(ActionMapping mapping,
    ActionForm form, HttpServletRequest request,
    HttpServletResponse response) throws Exception {
    try
    {
    KH010Form thisForm = (KH010Form) form;
    KH010Logic KH010Logic = new KH010Logic();

    FormFile file=thisForm.getWorkhistory();

    FormFile file2 = thisForm.getProjecthistory();

    String workfile = file.getFileName();
    String projectfile = file2.getFileName(); String uploadPath = BseSystemPropertyCopy.getInstance().getProperty("updown_path")+"\\";

    if(!(new File(uploadPath).isDirectory()))
    {
    new File(uploadPath).mkdir();
    } if (!workfile.equals(""))
    {
    copy2(file,uploadPath);
    }

    if (!projectfile.equals(""))
    {
    copy2(file2,uploadPath);
    }

    KH010Logic.updateFile(thisForm, request,workfile,projectfile);

    thisForm.setCloseflg("1");
    }
    catch (Exception exp)
    {
    logger.error(exp);
    return (mapping.findForward("ERROR"));
    }

    return (mapping.findForward(KH010Constants.PAGE_KH016));
    }