求救,大虾请进(在线等......) 我想用fileupload的组件,上传图片到图片服务器,请问应该怎么写?比如说我的HTML页面在192.168.1.10这台机器上,但是我操作的时候想把图片传到192.168.1.12这台机器上,两台机器都是linux系统,而且都有密码,程序该怎样写? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 先把图片上传到服务器,也就是192.168.1.10,然后再把图片上传到192.168.1.12。。至于10怎么到12那就得看你自己采取什么方式了,如果是直接写文件的话,那必须给10权限,如果是12开了FTP服务器的话,直接FTP上传就OK 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)); } js是客户端?如何理解呢? alert后页面焦点问题 jstl严重问题 视频不能播放 SQL语句的问题!!!!!!!!!! 请教URL/URLConnection类的问题 循环显示的问题:) 关于struts2 的求助啊!!! 请教Servlets存放路径的问题 【请教】org.springframework.web.servlet.PageNotFound - No mapping found for HTTP req 如何使得XML文件读写同步 jsp:include 乱码问题
至于10怎么到12那就得看你自己采取什么方式了,如果是直接写文件的话,那必须给10权限,如果是12开了FTP服务器的话,直接FTP上传就OK
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));
}