<%@page contentType="text/html; charset=UTF-8"%> <%@page import="com.csc.library.entry.HelpEntry,com.csc.library.system.*,com.csc.library.utilities.*"%> <%@ page import="com.csc.library.entry.*,com.csc.library.database.*,com.csc.library.session.*" %> <%@page import="java.util.*,java.net.*,java.io.*,com.csc.upload.*"%> <jsp:useBean id="hmul" class="com.csc.upload.HttpMultiPartParser" scope="page"/> <jsp:useBean id="UPLOADCOM" class="com.csc.library.system.Task" scope="page"/><% UPLOADCOM.setChannel(request,response); UPLOADCOM.checkProfile(); UProfile u=UPLOADCOM.getUProfile(); InitialEnvironment en = new InitialEnvironment("GLOBAL"); String reffilePath=en.getValue("COMPANY_UPLOAD-dir"); String tempdir = "."; request.setAttribute("dir", reffilePath); String browser_name = request.getRequestURI(); CheckNull chk =new CheckNull(); %> <% session.setAttribute("finishUpload","false"); if ((request.getContentType()!=null) && (request.getContentType().toLowerCase().startsWith("multipart"))){ response.setContentType("text/html"); try{ int bstart = request.getContentType().lastIndexOf("oundary="); String bound = request.getContentType().substring(bstart+8); Hashtable ht = hmul.processData(request.getInputStream(), bound, tempdir); ht.put("dir", reffilePath); hmul.uploadFiles(ht,u); session.setAttribute("uploadFileName", hmul.getStringFile()); session.setAttribute("finishUpload","true"); } catch (Exception e){ } } %> <html> <head> <title></title> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <link href="../CSS/TISCO.css" rel="stylesheet" type="text/css"> <link href="../CSS/MENU.css" rel="stylesheet" type="text/css"> <script language="JavaScript" src="../JS/SCREEN.js"></script> <script src="../JS/VIEWCALENDAR.js"></script> <script language='javascript'>setLang('<%=u.get("lang")%>');</script> <script language="JavaScript" > function uploadfile(){ if(checkFile()){ with(document.cscform){ __cmd.value = "saveparent"; submit(); } } } function checkFile(){ var chk=false; with(document.cscform) { if(myFile.value.length>0) { chk = true } else if (myFile.value.length==0) { alert("กรุณาเลือกไฟล์ก่อน"); } } return chk; } function closePage(){ window.parent.document.cscform.__attac.value="<%=session.getAttribute("uploadFileName")%>"; window.parent.saveChild(); } </script> <style type="text/css"> <!-- body { background-color: #EFEFEF; } --> </style> </head> <body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" > <form name="cscform" enctype="multipart/form-data" method="POST"> <input type="hidden" name="__cmd" value="1"> <input type="hidden" name="__screen" value="UPLOADCOM"> <input type="hidden" name="__companyid" value="<%=u.get("companyid")%>"> <input type="hidden" name="__language" value ="<%=u.get("lang")%>"> <DIV align="center"> <table width="38%" cellpadding="0" cellspacing="0" class="maxsize"> <tr> <td width="8%"></td> <td width="0%"> </td> <td width="16%"> </td> <td width="12%"><div align="right"> <script language='javascript'>swapLang('Attach file');</script> </div></td> <td width="64%"><input type="file" name="myFile" ></td> </tr> </table> </DIV> <% if((request.getContentType()!=null)){ %> <script language="javascript">closePage();</script> <% } %> </form> </body> </html>