<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    Rising Sun

      BlogJava :: 首頁 :: 新隨筆 :: 聯(lián)系 :: 聚合  :: 管理 ::
      148 隨筆 :: 0 文章 :: 22 評論 :: 0 Trackbacks
    1. <!--$Header:?ProcessFileUpload.jsp?1.0.0?2004/10/22?15:10:19?pkm?ship??$-->
    2. <%@?page?contentType="text/html;charset=GB2312"%>
    3. <%@?page?import="org.apache.commons.fileupload.DiskFileUpload"%>
    4. <%@?page?import="org.apache.commons.fileupload.FileItem"%>
    5. <%@?page?import="java.util.*"%>
    6. <%@?page?import="java.io.File"%>
    7. <%@?page?import="java.sql.*"?%>
    8. <html>
    9. <head>
    10. <style>
    11. .NButton
    12. {
    13. ????cursor:hand;
    14. ????width:?87px;
    15. ????height:?20px;
    16. ????font-family:?宋體;
    17. ????font-size:?12px;
    18. ????text-align:center?;
    19. ????background-image:?url(btn_bkg.gif);
    20. ????border:0px;
    21. }
    22. </style>
    23. <%!
    24. //?Connect?to?Oracle?database?and?Insert?into?cux_upload_files
    25. public ?void?dbInsert(String?p_c_file_name,String?p_c_path,String?p_s_file_name,String?p_s_path)?{
    26. ????Connection?conn?=?null;
    27. ????String?connStr;
    28. ??try?{
    29. ????connStr="jdbc:oracle:thin:@local:1521:orcl";
    30. ????DriverManager.registerDriver(new?oracle.jdbc.driver.OracleDriver());
    31. ????conn?=?DriverManager.getConnection(connStr,"apps",?"apps");
    32. ????//?Insert?into?table
    33. ????conn.setAutoCommit(false);?
    34. ????PreparedStatement?insertCUF?=?conn.prepareStatement("INSERT?INTO?cux.cux_upload_files(file_id,client_file_name,client_path,server_file_name,server_path,created_by,creation_date)?"
    35. ????+?"?VALUES?(cux.cux_upload_files_s.nextval,?,?,?,?,?,SYSDATE)?");
    36. ??
    37. ????//insertCUF.setInt(1,2);
    38. ????insertCUF.setString(1,p_c_file_name);
    39. ????insertCUF.setString(2,p_c_path);
    40. ????insertCUF.setString(3,p_s_file_name);
    41. ????insertCUF.setString(4,p_s_path);
    42. ????insertCUF.setString(5,"XXX");
    43. ????insertCUF.executeUpdate();
    44. ??
    45. ????conn.commit();
    46. ??
    47. ????conn.setAutoCommit(true);
    48. ??
    49. ????conn.close();
    50. ??}catch(SQLException?ex)?{?//?Handle?SQL?errors
    51. ??????System.out.println("Error?in?Connecting?to?the?Database?"+'\n'+ex.toString());
    52. ??}
    53. }
    54. //
    55. String ?getCurDate(){
    56. ????GregorianCalendar?gcDate?=?new?GregorianCalendar();?
    57. ????int?year??=?gcDate.get(GregorianCalendar.YEAR);
    58. ????int?month?=?gcDate.get(GregorianCalendar.MONTH);
    59. ????int?day???=?gcDate.get(GregorianCalendar.DAY_OF_MONTH);
    60. ????return?""?+?year?+?"-"?+?month?+?"-"?+?day;
    61. }
    62. %>
    63. <meta?http-equiv="Content-Type"?content="text/html;?charset=gb2312"?>
    64. <title>Process?File?Upload</title>
    65. </head>
    66. <body>
    67. <table?width="800"?border?bordercolor="#0000FF">
    68. <tr?bgcolor="#66CCFF">
    69. <td?colspan=1?rowspan=1?align=left?valign=top>
    70. ????<strong><font?size=2?face="宋體"?color=#000000>
    71. ????<nobr>客戶端文件</nobr>
    72. ????</font>
    73. ????</strong></td>
    74. <td?colspan=1?rowspan=1?align=left?valign=top>
    75. ????<strong><font?size=2?face="宋體"?color=#000000>
    76. ????<nobr>服務(wù)器文件</nobr>
    77. ????</font>
    78. ????</strong></td>
    79. <td?colspan=1?rowspan=1?align=left?valign=top>
    80. ????<strong><font?size=2?face="宋體"?color=#000000>
    81. ????<nobr>上傳用戶</nobr>
    82. ????</font>
    83. ????</strong></td>
    84. </tr>
    85. <%
    86. ????//out.println("Content?Type?="+request.getContentType());
    87. ????
    88. ????DiskFileUpload?fu?=?new?DiskFileUpload();
    89. ????//?If?file?size?exceeds,?a?FileUploadException?will?be?thrown
    90. ????fu.setSizeMax(1000000);
    91. ????//?maximum?size?that?will?be?stored?in?memory
    92. ????fu.setSizeThreshold(4096);
    93. ????//?the?location?for?saving?data?that?is?larger?than?getSizeThreshold()
    94. ????//fu.setRepositoryPath("/tmp/");
    95. ????
    96. ????
    97. ????List?fileItems?=?fu.parseRequest(request);
    98. ????Iterator?itr?=?fileItems.iterator();
    99. ????int?i?=?0;
    100. ??
    101. ????while(itr.hasNext())?{
    102. ??????FileItem?fi?=?(FileItem)itr.next();
    103. ??????i++;
    104. ??????//Check?if?not?form?field?so?as?to?only?handle?the?file?inputs
    105. ??????//else?condition?handles?the?submit?button?input
    106. ??????if?(!fi.isFormField())?{
    107. ????????????String?filename?=?fi.getName();
    108. ????????????long?filesize?=?fi.getSize();
    109. ??????String?pUserName?=?"XIAOHUIPING";
    110. ????????????if((filename==null||filename.equals(""))?&&?filesize==0)
    111. ????????????continue;
    112. ????????????//?注意fi.getName()
    113. ????????????//?會返回上載文件在客戶端的完整路徑名稱,這似乎是一個BUG。
    114. ????????????//?為解決這個問題,這里使用了fullFile.getName()。
    115. ????????????filename=filename.replace('\\','/');
    116. ????????????//new?String(filename.getBytes("ISO-8859-1"),"UTF-8");
    117. ????????????File?fullFile?=?new?File(filename);
    118. ????????????//?指定fullFile.getName()?=?"Works.txt";
    119. ????????????File?savedFile=?new?File(application.getRealPath("/Download/"),?fullFile.getName());
    120. ????????????fi.write(savedFile);
    121. ????????????//?上傳文件成功后寫入數(shù)據(jù)庫表
    122. ????????????dbInsert(fullFile.getName(),filename.replace('/','\\'),fullFile.getName(),savedFile.getAbsolutePath());
    123. ??????if?((i%2)?==?0)?{
    124. ????????????//?文件上載成功提示,以表格形式打印
    125. ??????out.println("<tr?bgcolor=\"#CCCCCC\"><td?colspan=1?rowspan=1?align=left?valign=top><font?size=2?face=\"宋體\"?color=#000000><nobr>"?+?fullFile.getName()?+?"</nobr></font></td><td?colspan=1?rowspan=1?align=left?valign=top><font?size=2?face=\"宋體\"?color=#000000><nobr>"?+?fullFile.getName()?+?"</nobr></font></td><td?colspan=1?rowspan=1?align=left?valign=top><font?size=2?face=\"宋體\"?color=#000000><nobr>"?+?pUserName?+?"</nobr></font></td></tr>");
    126. ????????????//out.println("<br>"?+?"Local?Filename?=?"?+?"\""?+?filename.replace('/','\\')?+?"\""?+?"?Upload?To?\""??+?savedFile.getAbsolutePath()?+?"\""?+?"?Successful!!");
    127. ????????????}
    128. ??????else?if?((i%2)?==?1)?{
    129. ??????out.println("<tr><td?colspan=1?rowspan=1?bgcolor=#ffffff?align=left?valign=top><font?size=2?face=\"宋體\"?color=#000000><nobr>"?+?fullFile.getName()?+?"</nobr></font></td><td?colspan=1?rowspan=1?bgcolor=#ffffff?align=left?valign=top><font?size=2?face=\"宋體\"?color=#000000><nobr>"?+?fullFile.getName()?+?"</nobr></font></td><td?colspan=1?rowspan=1?bgcolor=#ffffff?align=left?valign=top><font?size=2?face=\"宋體\"?color=#000000><nobr>"?+?pUserName?+?"</nobr></font></td></tr>");
    130. ??????}
    131. ??????}
    132. ????}
    133. %>
    134. </table>
    135. <table?width="800"?border?bordercolor="#0000FF">
    136. ??<tr>
    137. ????<td?height="20"?align="center"?nowrap="nowrap">
    138. ??????<DIV?align="center">
    139. ????????<input?class="NButton"?type="button"?value="Back"?onClick="javascript:history.back()"/>
    140. ????????<input?class="NButton"?type="button"?value="Close"?onClick="javascript:window.close()"/>
    141. ??????</DIV>
    142. ????</td>
    143. ??</tr>
    144. </table>
    145. </body>
    146. </html>



    1. <!--$Header:?index.jsp?1.0.0?2004/10/22?15:10:19?pkm?ship??$-->
    2. <%@?page?contentType?=?"text/html;charset=gb2312"?%>
    3. <html>
    4. <head>
    5. <title>數(shù)據(jù)文件上傳</title>
    6. <style>
    7. BODY
    8. {
    9. ??FONT-FAMILY:?宋體;
    10. ??FONT-SIZE:?10pt;
    11. ????background-color:?#F6F6F6;
    12. ????margin-top:?10px;
    13. ????margin-right:?50px;
    14. ????margin-bottom:?50px;
    15. ????margin-left:?10px;
    16. ????margin-top:?0px
    17. ????SCROLLBAR-FACE-COLOR:?#D0E5FF;
    18. ????SCROLLBAR-HIGHLIGHT-COLOR:?#F5F9FF;
    19. ????SCROLLBAR-SHADOW-COLOR:?#828282;
    20. ????SCROLLBAR-3DLIGHT-COLOR:?#828282;
    21. ????SCROLLBAR-ARROW-COLOR:?#797979;
    22. ????SCROLLBAR-TRACK-COLOR:?#ECECEC;
    23. ????SCROLLBAR-DARKSHADOW-COLOR:?#ffffff
    24. }
    25. TABLE
    26. {
    27. ??FONT-FAMILY:?宋體;
    28. ??FONT-SIZE:?10pt
    29. }
    30. .HeaderTitle{
    31. ????font-family:?黑體;
    32. ????font-size:?30px;
    33. ????font-weight:?bolder;
    34. ????color:?#041986;
    35. }
    36. .TitleBar
    37. {
    38. ??BACKGROUND-COLOR:?#E5EAED;
    39. ??Color:#565656;
    40. ??FONT-FAMILY:?宋體;
    41. ??font-weight:bold;
    42. ??FONT-SIZE:?11pt;
    43. }
    44. .TextBox
    45. {
    46. ????FONT-FAMILY:?宋體;
    47. ????FONT-SIZE:?10pt;
    48. ????height:?20px;
    49. ????BORDER-BOTTOM:?1pt?solid?#C6C6C6;
    50. ????BORDER-LEFT:?1pt?solid?#C6C6C6;
    51. ????BORDER-RIGHT:?1pt?solid?#C6C6C6;
    52. ????BORDER-TOP:?1pt?solid?#C6C6C6;
    53. }
    54. .InputGridTable{
    55. ??FONT-FAMILY:?宋體;
    56. ??FONT-SIZE:?10pt;
    57. ????border-collapse:?collapse;
    58. ????border-color:#C6C6C6;
    59. ????border-style:?solid;
    60. ????border-width:?1;
    61. ????padding:?0;
    62. }
    63. .TitleColumn{
    64. ????background-color:?#E8ECF0;
    65. ????nowrap="nowrap";
    66. ??HEIGHT:?20px
    67. }
    68. .NButton
    69. {
    70. ????cursor:hand;
    71. ????width:?87px;
    72. ????height:?20px;
    73. ????font-family:?宋體;
    74. ????font-size:?12px;
    75. ????text-align:center?;
    76. ????background-image:?url(btn_bkg.gif);
    77. ????border:0px;
    78. }
    79. </style>
    80. <script?language="javascript">
    81. var?count?=?1;
    82. function?delAttacheFile(){
    83. ????var?targetRow?=?event.srcElement.parentElement.parentElement;
    84. ????InputTable.deleteRow(targetRow.rowIndex);
    85. }
    86. function?addAttacheFile(){
    87. ????count?++;
    88. ????var?row?=?InputTable.insertRow(InputTable.rows.length);
    89. ????var?firstCell?=?row.insertCell(0);
    90. ????firstCell.className?=?"TitleColumn";
    91. ????firstCell.width?=?"10%";
    92. ????firstCell.height?=?"20";
    93. ????firstCell.innerHTML?=?"<strong>?附件?"?+?count+?"?:</strong>";
    94. ????var?lastCell?=?row.insertCell(1);
    95. ????lastCell.height?=?"20";
    96. ????lastCell.innerHTML?=?"<input?type='file'?name='attacheFile"?+?count?+?"'?size='50'?class='TextBox'>?<input?type='button'?value='刪除附件?"?+?count?+?"'?onclick='delAttacheFile();'?class='NButton'>";
    97. }
    98. </script>
    99. </head>
    100. <body>
    101. ??<form?name="filesForm"?method="POST"?action="ProcessFileUpload.jsp"?enctype="multipart/form-data">
    102. ????<table?id="InputTable"?border="1"?cellpadding="0"?cellspacing="0"?class="InputGridTable"?width="100%"?height="40"?>
    103. ??????<tr>
    104. ????????<td?nowrap="nowrap"?height="20"?colspan="3"?class="TitleColumn"><div?align="center"><strong>附件列表:</strong></div></td>
    105. ??????</tr>
    106. ??????<tr>
    107. ????????<td?nowrap="nowrap"?width="10%"?height="20"?class="TitleColumn"><strong>附件?1?:</strong></td>
    108. ????????<td?height="20"?nowrap="nowrap"><input?type="file"?class="TextBox"?name="attacheFile1"?size="50">?<input?name="adfile"?type="button"?class="NButton"?onClick="addAttacheFile();"?value="添加附件"></td>
    109. ??????</tr>
    110. ????</table>
    111. ????<table?id="SubmitTable"?border="1"?cellpadding="0"?cellspacing="0"?class="InputGridTable"?width="100%"?height="20"?>
    112. ??????<tr>
    113. ????????<td?height="20"?align="center"?nowrap="nowrap">
    114. ??????????<input?type="submit"?name="close"?value="Close"?onClick="self.close();"?class="NButton"/>
    115. ??????????<input?type="reset"?name="reset"?value="Clear"?class="NButton"/>
    116. ??????????<input?type="submit"?name="Submit"?value="Upload"?class="NButton"/>?
    117. ????????</td>
    118. ??????</tr>
    119. ????</table>
    120. ??</form>
    121. ????<p>?</p>
    122. </body>
    123. </html>
    posted on 2006-07-13 16:32 brock 閱讀(609) 評論(0)  編輯  收藏

    只有注冊用戶登錄后才能發(fā)表評論。


    網(wǎng)站導(dǎo)航:
     
    主站蜘蛛池模板: sss在线观看免费高清| 久久国产色AV免费看| 亚洲AV中文无码乱人伦下载| 亚洲精品在线免费观看视频| 亚洲AV成人一区二区三区观看| 亚洲热线99精品视频| 亚洲电影免费观看| 美女啪啪网站又黄又免费| 久久久久亚洲精品影视| 日日AV拍夜夜添久久免费| 嫩草影院在线播放www免费观看| 亚洲狠狠成人综合网| 国产AV无码专区亚洲AV漫画| 国拍在线精品视频免费观看 | 国产成人免费网站| 亚洲阿v天堂在线2017免费| 亚洲欧洲尹人香蕉综合| 在线观看91精品国产不卡免费| 鲁丝片一区二区三区免费| 性色av极品无码专区亚洲| 亚洲国产女人aaa毛片在线| 国产在线19禁免费观看国产| 久久国产色AV免费观看| 少妇亚洲免费精品| 中文字幕在线日亚洲9| 无码专区—VA亚洲V天堂| 亚洲不卡AV影片在线播放| 精品国产无限资源免费观看| 中文毛片无遮挡高清免费| 亚洲色偷偷色噜噜狠狠99网| 亚洲经典在线中文字幕| 伊人久久大香线蕉亚洲| 国产小视频免费观看| a级毛片无码免费真人| 91精品导航在线网址免费| 中文字幕免费在线看线人动作大片 | 午夜两性色视频免费网站| 在线人成精品免费视频| 三级毛片在线免费观看| 黄色免费网址在线观看| 亚洲欧好州第一的日产suv|