ï»??xml version="1.0" encoding="utf-8" standalone="yes"?>欧美亚男人的天堂,亚洲视频在线视频,亚洲男女毛片无遮挡 http://www.aygfsteel.com/leekiang/category/25298.htmlMDA/MDD/TDD/DDD/DDDDDDD zh-cn Thu, 04 Feb 2010 14:54:54 GMT Thu, 04 Feb 2010 14:54:54 GMT 60 多文件上ä¼?/title><link>http://www.aygfsteel.com/leekiang/archive/2010/02/02/311732.html</link><dc:creator>leekiang</dc:creator><author>leekiang</author><pubDate>Tue, 02 Feb 2010 14:57:00 GMT</pubDate><guid>http://www.aygfsteel.com/leekiang/archive/2010/02/02/311732.html</guid><wfw:comment>http://www.aygfsteel.com/leekiang/comments/311732.html</wfw:comment><comments>http://www.aygfsteel.com/leekiang/archive/2010/02/02/311732.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.aygfsteel.com/leekiang/comments/commentRss/311732.html</wfw:commentRss><trackback:ping>http://www.aygfsteel.com/leekiang/services/trackbacks/311732.html</trackback:ping><description><![CDATA[
<a target="_blank" >jquery-transmit</a>:<br />jQuery Multi-file Uploader with Flash<img src ="http://www.aygfsteel.com/leekiang/aggbug/311732.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.aygfsteel.com/leekiang/" target="_blank">leekiang</a> 2010-02-02 22:57 <a href="http://www.aygfsteel.com/leekiang/archive/2010/02/02/311732.html#Feedback" target="_blank" style="text-decoration:none;">å‘表评论</a></div>]]></description></item><item><title>commons-fileupload 1.2å‘布时的官方声明 http://www.aygfsteel.com/leekiang/archive/2008/09/27/231469.htmlleekiang leekiang Sat, 27 Sep 2008 04:34:00 GMT http://www.aygfsteel.com/leekiang/archive/2008/09/27/231469.html http://www.aygfsteel.com/leekiang/comments/231469.html http://www.aygfsteel.com/leekiang/archive/2008/09/27/231469.html#Feedback 0 http://www.aygfsteel.com/leekiang/comments/commentRss/231469.html http://www.aygfsteel.com/leekiang/services/trackbacks/231469.html Compared to the previous version 1.1.1, the following notable changes have been made:    * A streaming API has been added. The streaming API allows to handle arbitrarily large files without intermediary files while still keeping an extremely low memory profile.    * The presence of a content-length header is no longer required.    * Added support for progress listeners.    * Added support for header continuation lines.    * Added support for limiting the actual file size, as opposed to the request size. ]]> hibernate处ç†oracle大嗌D?/title><link>http://www.aygfsteel.com/leekiang/archive/2008/09/24/230867.html</link><dc:creator>leekiang</dc:creator><author>leekiang</author><pubDate>Wed, 24 Sep 2008 06:01:00 GMT</pubDate><guid>http://www.aygfsteel.com/leekiang/archive/2008/09/24/230867.html</guid><wfw:comment>http://www.aygfsteel.com/leekiang/comments/230867.html</wfw:comment><comments>http://www.aygfsteel.com/leekiang/archive/2008/09/24/230867.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.aygfsteel.com/leekiang/comments/commentRss/230867.html</wfw:commentRss><trackback:ping>http://www.aygfsteel.com/leekiang/services/trackbacks/230867.html</trackback:ping><description><![CDATA[1,以下是一些零¼„Žçš„记录åQŒä¸å…¨ã€?br /><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(0, 128, 0);">//</span><span style="color: rgb(0, 128, 0);">å—æ®µä¸ºjava.sql.Blob¾cÕdž‹</span><span style="color: rgb(0, 128, 0);"><br /></span><span style="color: rgb(0, 0, 0);">Fj fj </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">new</span><span style="color: rgb(0, 0, 0);"> Fj();<br />fj.setAttblob(Hibernate.createBlob(</span><span style="color: rgb(0, 0, 255);">new</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">byte</span><span style="color: rgb(0, 0, 0);">[</span><span style="color: rgb(0, 0, 0);">1</span><span style="color: rgb(0, 0, 0);">]));</span><span style="color: rgb(0, 128, 0);">//</span><span style="color: rgb(0, 128, 0);">用empty_blob()替æ¢?</span><span style="color: rgb(0, 128, 0);"><br /></span><span style="color: rgb(0, 0, 0);">session.save(fj);<br />session.flush();<br />session.refresh(fj, LockMode.UPGRADE);<br />org.hibernate.blob.SerializableBlob sb </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"><br />(org.hibernate.blob.SerializableBlob) fj.getAttblob();<br />oracle.sql.BLOB blob </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> (oracle.sql.BLOB) sb.getWrappedBlob();<br />OutputStream os </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> blob.getBinaryOutputStream();<br /></span><span style="color: rgb(0, 128, 0);">//</span><span style="color: rgb(0, 128, 0);">------</span></div><br />2,用jdbcè¯Õd–CLOB<br />http://hi.baidu.com/xh28025/blog/item/f61c2df1ef8130c47831aa70.html<br /><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(0, 0, 0);">String description </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">""</span><span style="color: rgb(0, 0, 0);"><br />   query </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">select picstr from clobtest_table where id = '001'</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">;<br />pstmt </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> con.prepareStatement(query);<br />ResultSet result </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> pstmt.executeQuery();<br /></span><span style="color: rgb(0, 0, 255);">if</span><span style="color: rgb(0, 0, 0);">(result.next()){<br />   oracle.jdbc.driver.OracleResultSet ors </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"><br />   (oracle.jdbc.driver.OracleResultSet)result;<br />   oracle.sql.CLOB clobtmp </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> (oracle.sql.CLOB) ors.getClob(</span><span style="color: rgb(0, 0, 0);">1</span><span style="color: rgb(0, 0, 0);">);<br /><br />   </span><span style="color: rgb(0, 0, 255);">if</span><span style="color: rgb(0, 0, 0);">(clobtmp</span><span style="color: rgb(0, 0, 0);">==</span><span style="color: rgb(0, 0, 255);">null</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">||</span><span style="color: rgb(0, 0, 0);"> clobtmp.length()</span><span style="color: rgb(0, 0, 0);">==</span><span style="color: rgb(0, 0, 0);">0</span><span style="color: rgb(0, 0, 0);">){<br />   System.out.println(</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">======CLOB对象为空 </span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">);<br />   description </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">""</span><span style="color: rgb(0, 0, 0);">;<br />   }</span><span style="color: rgb(0, 0, 255);">else</span><span style="color: rgb(0, 0, 0);">{<br />   description</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">clobtmp.getSubString((</span><span style="color: rgb(0, 0, 255);">long</span><span style="color: rgb(0, 0, 0);">)</span><span style="color: rgb(0, 0, 0);">1</span><span style="color: rgb(0, 0, 0);">,(</span><span style="color: rgb(0, 0, 255);">int</span><span style="color: rgb(0, 0, 0);">)clobtmp.length());//ä»?å¼€å§?<br />   System.out.println(</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">======å—符串åÅžå¼Â?/span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">+</span><span style="color: rgb(0, 0, 0);">description);<br />   }<br />}</span></div><br /><br /><img src ="http://www.aygfsteel.com/leekiang/aggbug/230867.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.aygfsteel.com/leekiang/" target="_blank">leekiang</a> 2008-09-24 14:01 <a href="http://www.aygfsteel.com/leekiang/archive/2008/09/24/230867.html#Feedback" target="_blank" style="text-decoration:none;">å‘表评论</a></div>]]></description></item><item><title>使用commons fileupload的零¼„Žç¬”è®?/title><link>http://www.aygfsteel.com/leekiang/archive/2007/08/27/139844.html</link><dc:creator>leekiang</dc:creator><author>leekiang</author><pubDate>Mon, 27 Aug 2007 03:58:00 GMT</pubDate><guid>http://www.aygfsteel.com/leekiang/archive/2007/08/27/139844.html</guid><wfw:comment>http://www.aygfsteel.com/leekiang/comments/139844.html</wfw:comment><comments>http://www.aygfsteel.com/leekiang/archive/2007/08/27/139844.html#Feedback</comments><slash:comments>5</slash:comments><wfw:commentRss>http://www.aygfsteel.com/leekiang/comments/commentRss/139844.html</wfw:commentRss><trackback:ping>http://www.aygfsteel.com/leekiang/services/trackbacks/139844.html</trackback:ping><description><![CDATA[我对表å•ä¸Šä¼ çš„ç†è§?å¯èƒ½æœ‰è¯¯):<br /> <form action="" method="post" enctype="multipart/form-data"><br /> 最大上ä¼?G.<br /><a target="_blank" >通过 http åè®®ä¸Šä¼ æ–‡äšg(rfc1867å议概述åQŒjsp 应用举例åQŒå®¢æˆïL«¯å‘é€å†…å®ÒŽž„é€?</a><br /> æœåŠ¡å™¨æŽ¥æ”¶åˆ°ä¸Šä¼ çš„æµåQŒè‡ªå·±å…¶å®žæ˜¯ä¸ä½œä»ÖM½•处ç†çš„,那个request˜q˜æ˜¯åŽŸè£…çš?è°æ¥å¤„熘q™ä¸ªrequestå‘?ä¸€èˆ¬é‡‡ç”¨ç¬¬ä¸‰æ–¹çš„å·¥å…øP¼Œ˜q™é‡Œä»¥commons fileuploadä¸ÞZ¾‹.<br /> <div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(0, 0, 0);">DiskFileItemFactory factory </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">new</span><span style="color: rgb(0, 0, 0);"> DiskFileItemFactory();<br />factory.setSizeThreshold(</span><span style="color: rgb(0, 0, 0);">4096</span><span style="color: rgb(0, 0, 0);">);</span><span style="color: rgb(0, 128, 0);">//</span><span style="color: rgb(0, 128, 0);"> 讄¡½®¾~“冲,˜q™ä¸ªå€¼å†³å®šäº†æ˜¯fileinputstream˜q˜æ˜¯bytearrayinputstream</span><span style="color: rgb(0, 128, 0);"><br /></span><span style="color: rgb(0, 0, 0);">factory.setRepository(new File(</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">d:\\temp</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">));</span><span style="color: rgb(0, 128, 0);">//</span><span style="color: rgb(0, 128, 0);">讄¡½®ä¸´æ—¶å˜æ”¾ç›®å½•,默认是new File(System.getProperty("java.io.tmpdir"))</span><span style="color: rgb(0, 128, 0);"><br /></span><span style="color: rgb(0, 0, 0);">ServletFileUpload sfu </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">new</span><span style="color: rgb(0, 0, 0);"> ServletFileUpload(factory);<br />sfu.setSizeMax(</span><span style="color: rgb(0, 0, 0);">100</span><span style="color: rgb(0, 0, 0);">*</span><span style="color: rgb(0, 0, 0);">1024</span><span style="color: rgb(0, 0, 0);">*</span><span style="color: rgb(0, 0, 0);">1024</span><span style="color: rgb(0, 0, 0);">);</span><span style="color: rgb(0, 128, 0);">//</span><span style="color: rgb(0, 128, 0);">100M</span><span style="color: rgb(0, 128, 0);"><br /></span><span style="color: rgb(0, 0, 0);">List items </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> sfu.parseRequest(request);</span><span style="color: rgb(0, 128, 0);">//</span><span style="color: rgb(0, 128, 0);">ä¼ å…¥çš„è¿™ä¸ªrequest˜q˜æ˜¯åŽŸè£…çš?/span></div> è§ä¸Šé¢çš„代ç åQŒcommons fielupload通过ServletFileUpload¾cÈš„<span style="color: rgb(0, 0, 0);"><font color="#0000ff">parseRequest(request)<font color="#000000">æ–ÒŽ³•处熘q™ä¸ªåŽŸå§‹‹¹ã€‚è€?/font></font></span>ServletFileUpload<span style="color: rgb(0, 0, 0);"><font color="#0000ff"><font color="#000000">åˆä¼šè°ƒç”¨å…¶çˆ·çˆïL±»FileUploadBaseçš„parseRequest(request)æ–ÒŽ³•åQŒç„¶åŽåˆä¼šè°ƒreturn parseRequest(new ServletRequestContext(request)),代ç 如下<br /><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(0, 0, 0);"><br />        </span><span style="color: rgb(0, 0, 255);">try</span><span style="color: rgb(0, 0, 0);"> {<br />            FileItemIterator iter </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> getItemIterator(ctx);<br />            List items </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">new</span><span style="color: rgb(0, 0, 0);"> ArrayList();<br />            FileItemFactory fac </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> getFileItemFactory();<br />            </span><span style="color: rgb(0, 0, 255);">if</span><span style="color: rgb(0, 0, 0);"> (fac </span><span style="color: rgb(0, 0, 0);">==</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">null</span><span style="color: rgb(0, 0, 0);">) {<br />                </span><span style="color: rgb(0, 0, 255);">throw</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">new</span><span style="color: rgb(0, 0, 0);"> NullPointerException(<br />                    </span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">No FileItemFactory has been set.</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">);<br />            }<br />            </span><span style="color: rgb(0, 0, 255);">while</span><span style="color: rgb(0, 0, 0);"> (iter.hasNext()) {<br />                FileItemStream item </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> iter.next();<br />                FileItem fileItem </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> fac.createItem(item.getFieldName(),<br />                        item.getContentType(), item.isFormField(),<br />                        item.getName());<br />                </span><span style="color: rgb(0, 0, 255);">try</span><span style="color: rgb(0, 0, 0);"> {<br />                    Streams.copy(item.openStream(), fileItem.getOutputStream(),<br />                            </span><span style="color: rgb(0, 0, 255);">true</span><span style="color: rgb(0, 0, 0);">);<br />                } </span><span style="color: rgb(0, 0, 255);">catch</span><span style="color: rgb(0, 0, 0);"> (FileUploadIOException e) {<br />                    </span><span style="color: rgb(0, 0, 255);">throw</span><span style="color: rgb(0, 0, 0);"> (FileUploadException) e.getCause();<br />                } </span><span style="color: rgb(0, 0, 255);">catch</span><span style="color: rgb(0, 0, 0);"> (IOException e) {<br />                    </span><span style="color: rgb(0, 0, 255);">throw</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">new</span><span style="color: rgb(0, 0, 0);"> IOFileUploadException(//报错¾l常在这é‡?br />                            </span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">Processing of </span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">+</span><span style="color: rgb(0, 0, 0);"> MULTIPART_FORM_DATA<br />                            </span><span style="color: rgb(0, 0, 0);">+</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);"> request failed. </span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">+</span><span style="color: rgb(0, 0, 0);"> e.getMessage(), e);<br />                }<br />                </span><span style="color: rgb(0, 0, 255);">if</span><span style="color: rgb(0, 0, 0);"> (fileItem </span><span style="color: rgb(0, 0, 255);">instanceof</span><span style="color: rgb(0, 0, 0);"> FileItemHeadersSupport) {<br />                    </span><span style="color: rgb(0, 0, 255);">final</span><span style="color: rgb(0, 0, 0);"> FileItemHeaders fih </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> item.getHeaders();<br />                    ((FileItemHeadersSupport) fileItem).setHeaders(fih);<br />                }<br />                items.add(fileItem);<br />            }<br />            </span><span style="color: rgb(0, 0, 255);">return</span><span style="color: rgb(0, 0, 0);"> items;<br />        } </span><span style="color: rgb(0, 0, 255);">catch</span><span style="color: rgb(0, 0, 0);"> (FileUploadIOException e) {<br />            </span><span style="color: rgb(0, 0, 255);">throw</span><span style="color: rgb(0, 0, 0);"> (FileUploadException) e.getCause();<br />        } </span><span style="color: rgb(0, 0, 255);">catch</span><span style="color: rgb(0, 0, 0);"> (IOException e) {<br />            </span><span style="color: rgb(0, 0, 255);">throw</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">new</span><span style="color: rgb(0, 0, 0);"> FileUploadException(e.getMessage(), e);<br />        }<br />    </span></div><br /> ˜q™é‡Œæ³¨æ„,<font color="#0000ff">ä¸Šä¼ çš?lt;input type=file</font></font></font></span><font color="#0000ff">>æ ‡è®°ä¸€å®šè¦æœ‰name,如果没有åQŒcommons fieluploadä¸ä½œå¤„ç†</font>ã€?br /> commons fieluploadä¼šæŠŠä¸Šä¼ çš„æ–‡ä»¶ä»¥‹¹çš„æ–¹å¼å†™å…¥åˆ°tempæ–‡äšgå¤?临时文äšg夹å¯ä»¥è‡ªå·Þp®¾å®šï¼Œå¦‚æžœä¸æ‰‹åŠ¨è®¾¾|®ï¼Œåˆ™æ˜¯Servlet容器为web应用分é…çš„äÍæ—¶ç›®å½?tomcatå¯èƒ½ž®±æ˜¯<font color="#ff0000">%TOMCAT_HOME%\temp</font>åQŒæˆ‘用weblogicæ—Óž¼Œæ˜?font color="#ff0000">C:\DOCUME~1\yourname\LOCALS~1\Temp\</font>。这些äÍæ—¶æ–‡ä»¶ä»¥"upload"å¼€å¤ß_¼Œæ ¼å¼æ˜?tmp,例如<font color="#ff0000">"upload_47fdc3_11c9eb678b0__8000_00000043.tmp"</font><br />Â åœ¨ä¸Šä¼ è¿‡½E‹ä¸commons fieluploadæ‰çŸ¥é“ä¸Šä¼ çš„æ–‡äšg的大ž®ï¼Œå¦‚æžœä½ å®šä¹‰å…è®¸çš„æœ€å¤§é™„ä»¶äØ“100MåQŒç„¶åŽä½ ä¸Šä¼ ä¸€ä¸?00M的文ä»?é‚£ä¹ˆåªæœ‰å®žé™…ä¼ è¾“äº?00M以åŽåQŒcommons fieluploadæ‰çŸ¥é“è¶…˜q‡äº†åQŒç„¶å޿Лå‡ÞZ¸€ä¸ªå¼‚å¸?<font color="#ff0000">org.apache.commons.fileupload.FileUploadBase.SizeLimitExceededException</font>)ã€?br /> commons fielupload处ç†å®Œäº†ä»¥åŽ(处熘q‡ç¨‹å…¨åœ¨<span style="color: rgb(0, 0, 0);"><font color="#0000ff">parseRequest(request)</font>æ–ÒŽ³•é‡?/span>)åQŒè¿”回一个List,里é¢çš„æ¯ä¸€™å¹å·²è¢«å°è£…䨓FileItem,ä½ é€šè¿‡<font color="#0000ff">fileItem.isFormField()</font>判æ–出是普通的表å•属性呢åQŒè¿˜æ˜¯ä¸€ä¸ªæ–‡ä»Óž¼Œå¦‚果是文ä»Óž¼Œä½ å¯ä»¥ä»Ž<font color="#0000ff">fileItem.getInputStream()</font>获得输入‹¹ï¼Œ˜q™ä¸ªè¾“å…¥‹¹å…¶å®žæ˜¯ä¸€ä¸ªFileInputStream.当然åQŒå¦‚果文件很ž®ï¼Œåˆ™æ˜¯ByteArrayInputStream.那么如何区分åQŸè¿™ä¸¤è€…的区别是由<font color="#0000ff">factory.setSizeThreshold(4096)</font>¼‹®å®šçš„。大äº?K,为FileInputStream,ž®äºŽ4K为ByteArrayInputStream<br /><br />˜q™æ ·ž®±å¯ä»¥è§£é‡Šstruts用ActionForm的方å¼å¤„ç†ä¸Šä¼ 附件的一些问题了åQŒstruts接收到enctype="multipart/form-data"çš„postè¯äh±‚åŽï¼Œä¼šçœ‹é‚£ä¸ªå¯¹åº”çš„action有没有酾|®actionformåQŒå¦‚果酾|®äº†åQŒå°±ä¼šä½œä¸€äº›å¤„ç†ï¼Œæ‰€ä»¥ä½ 在action里得到的requestå·²ç»ä¸æ˜¯ä¸€ä¸ªæ™®é€šçš„request了,而是一个被ž®è£…˜q‡çš„request。如果想得到原始的requeståQŒå°±ä¸è¦struts-config.xml里给action¾c»é…¾|®actionform<br /><br />tempDir指定的目录ä¸å¯èƒ½ä¼šéšç€æ—‰™—´æŽ¨ç§»å‡ºçŽ°å¾ˆå¤šåŽç¼€ä¸?tmp"的垃圾文ä»Óž¼Œcommons-fileupload1.2æä¾›äº†ä¸€ä¸ªä¸é”™çš„解决æ–ÒŽ³•åQŒå°±æ˜¯æŠŠä¸‹é¢çš„代ç åŠ å…¥åˆ°web.xmlä¸å³å¯ã€?br /><listener><br /><listener-class><br />org.apache.commons.fileupload.servlet.FileCleanerCleanup<br /></listener-class><br /></listener> <br />æ¥æº:<a target="_blank" >http://fratemity1314.spaces.live.com/Blog/cns!E3BCC13A1E72BB4F!222.entry</a><br /><br /><span id="wmqeeuq" class="tpc_content">Q:I'm using FileUpload in an Action, but it's not working. Why? <br /><br />A:Struts
recognises multipart requests, and parses them automatically,
presenting the request parameters to your code in the same manner as if
they were regular request parameters. Since struts has already processed the request, and made it available in your form
bean, the input stream is no longer available for parsing, so
attempting to do so with FileUpload will fail. <br /><br />Q:But I need to parse the request myself. How can I do that? <br /><br />A:Struts
parses multipart a request as a part of the process of populating your
form bean from that request. If, for some reason, you need to have full
control over the multipart parsing, you can do so by configuring your
action mapping without an associated form bean. (A better way of doing
this, however, is to replace the default multipart handler with your
own. See the struts documentation for details.) </span><br /><br /><br />1åQŒç›´æŽ¥ç”¨commons fileupload而ä¸ç”¨strutsçš„ActionFormæ—?表å•里的属性å€ég¸èƒ½ç”¨request.getParameter()获å–了,而url里的queryStringå¯ä»¥ã€?br />2, 获å–form里的属性值的代ç <br /><br /><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; font-size: 13px; width: 98%; background-color: rgb(238, 238, 238);"><img src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align="top" /><span style="color: rgb(0, 0, 0);"><br /><img src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align="top" />                    String formname </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> fi.getFieldName();</span><span style="color: rgb(0, 128, 0);">//</span><span style="color: rgb(0, 128, 0);"> 获å–formä¸çš„åå—</span><span style="color: rgb(0, 128, 0);"><br /><img src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align="top" /></span><span style="color: rgb(0, 0, 0);">                    String formcontent </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> fi.getString();<br /><img id="Codehighlighter1_130_247_Open_Image" onclick="this.style.display='none'; Codehighlighter1_130_247_Open_Text.style.display='none'; Codehighlighter1_130_247_Closed_Image.style.display='inline'; Codehighlighter1_130_247_Closed_Text.style.display='inline';" src="http://www.aygfsteel.com/images/OutliningIndicators/ExpandedBlockStart.gif" align="top" /><img id="Codehighlighter1_130_247_Closed_Image" style="display: none;" onclick="this.style.display='none'; Codehighlighter1_130_247_Closed_Text.style.display='none'; Codehighlighter1_130_247_Open_Image.style.display='inline'; Codehighlighter1_130_247_Open_Text.style.display='inline';" src="http://www.aygfsteel.com/images/OutliningIndicators/ContractedBlock.gif" align="top" />                    </span><span style="color: rgb(0, 0, 255);">if</span><span style="color: rgb(0, 0, 0);"> (formname.equals(</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">id</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">)) </span><span id="Codehighlighter1_130_247_Closed_Text" style="border: 1px solid rgb(128, 128, 128); display: none; background-color: rgb(255, 255, 255);"><img src="http://www.aygfsteel.com/images/dot.gif" /></span><span id="Codehighlighter1_130_247_Open_Text"><span style="color: rgb(0, 0, 0);">{<br /><img src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align="top" />                        id </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> formcontent;</span><span style="color: rgb(0, 0, 0);"><br /><img id="Codehighlighter1_284_349_Open_Image" onclick="this.style.display='none'; Codehighlighter1_284_349_Open_Text.style.display='none'; Codehighlighter1_284_349_Closed_Image.style.display='inline'; Codehighlighter1_284_349_Closed_Text.style.display='inline';" src="http://www.aygfsteel.com/images/OutliningIndicators/ExpandedBlockStart.gif" align="top" /><img id="Codehighlighter1_284_349_Closed_Image" style="display: none;" onclick="this.style.display='none'; Codehighlighter1_284_349_Closed_Text.style.display='none'; Codehighlighter1_284_349_Open_Image.style.display='inline'; Codehighlighter1_284_349_Open_Text.style.display='inline';" src="http://www.aygfsteel.com/images/OutliningIndicators/ContractedBlock.gif" align="top" />                    }</span></span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">else</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">if</span><span style="color: rgb(0, 0, 0);"> (formname.equals(</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">title</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">)) </span><span id="Codehighlighter1_284_349_Closed_Text" style="border: 1px solid rgb(128, 128, 128); display: none; background-color: rgb(255, 255, 255);"><img src="http://www.aygfsteel.com/images/dot.gif" /></span><span id="Codehighlighter1_284_349_Open_Text"><span style="color: rgb(0, 0, 0);">{<br /><img src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align="top" />                        title </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> formcontent;<br /><img id="Codehighlighter1_389_463_Open_Image" onclick="this.style.display='none'; Codehighlighter1_389_463_Open_Text.style.display='none'; Codehighlighter1_389_463_Closed_Image.style.display='inline'; Codehighlighter1_389_463_Closed_Text.style.display='inline';" src="http://www.aygfsteel.com/images/OutliningIndicators/ExpandedBlockStart.gif" align="top" /><img id="Codehighlighter1_389_463_Closed_Image" style="display: none;" onclick="this.style.display='none'; Codehighlighter1_389_463_Closed_Text.style.display='none'; Codehighlighter1_389_463_Open_Image.style.display='inline'; Codehighlighter1_389_463_Open_Text.style.display='inline';" src="http://www.aygfsteel.com/images/OutliningIndicators/ContractedBlock.gif" align="top" />                    }</span></span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">else</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">if</span><span style="color: rgb(0, 0, 0);"> (formname.equals(</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">memo</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">)) </span><span id="Codehighlighter1_499_561_Closed_Text" style="border: 1px solid rgb(128, 128, 128); display: none; background-color: rgb(255, 255, 255);"><img src="http://www.aygfsteel.com/images/dot.gif" /></span><span id="Codehighlighter1_499_561_Open_Text"><span style="color: rgb(0, 0, 0);">{<br /><img src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align="top" />                        memo </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> formcontent;<br /><img src="http://www.aygfsteel.com/images/OutliningIndicators/ExpandedBlockEnd.gif" align="top" />                    }</span></span><span style="color: rgb(0, 0, 0);"><br /><img src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align="top" />                </span></div><br />3, 表å•里的file控äšgçš„nameä¸èƒ½ä¸ºç©ºã€?br />4åQŒä¸Šä¼ 大文äšg(190多M)时报异常<br />org.apache.commons.fileupload.FileUploadException:  Processing  of Â
multipart/form-data  request  failed.  EOF  after  reading  only:
 "3567789 "  of:  "203323339 "  promised  bytes,  out of  which  at  least:  "0 "  were  already  buffered<br />http://forums.bea.com/thread.jspa?threadID=200033356<br />http://dev2dev.bea.com.cn/bbs/thread.jspa?forumID=121&threadID=20060&start=0&tstart=0<br />http://thisisxy.blogcn.com/diary,204014352.shtml<br />http://www.80diy.com/home/20050527/17/4040711.html<br /><br />5åQ?br /><span lang="EN-US"><font face="Times New Roman" size="3">org.apache.commons.fileupload.FileUploadException: Processing of multipart/form-data request failed. Read timed out<br /></font></span><font size="3"><span style="font-family: 宋体;"></span><span lang="EN-US"><font face="Times New Roman">HTTP</font></span><span style="font-family: 宋体;">‹zÕdЍ‘…æ—¶é™åˆ¶çš„æ—¶é—´å¤ªçŸ?</span></font><span><strong><span id="wmqeeuq" class="guitag1">HTTP Keep-Alive Timeout</span></strong></span><span style="font-size: 10.5pt; font-family: Arial;" lang="EN-US">.<br /><br />6,InputStream is =formFile.getInputStream() ; //formFile是org.apache.struts.upload.FormFile<br />ä¸Šä¼ çš„æ–‡ä»¶å°æ—¶è¿™ä¸ªè¾“å…¥æµæ˜¯java.io.ByteArrayInputStreamåQŒä¸Šä¼ 比较大的文件时˜q™ä¸ªè¾“å…¥‹¹æ˜¯FileInputStream<br /><br />7,讄¡½®è¡¨å•é‡Œçš„ä¸Šä¼ è·¯å¾„ä¸ºåªè¯?br /><input type=file id="uploadfile" name="uploadfile" style="display: none;"><br /><input type=text id=tempfile readonly="true"><br /><input type=button <br />onClick="uploadfile.click();tempfile.value=uploadfile.value;" value="‹¹è§ˆ.."><br /><br />10,<br />http://eastpoint.javaeye.com/blog/99084<br />http://topic.csdn.net/u/20080131/13/649c57c7-204e-4bb6-9b09-49cca39f00b8.html<br />http://blog.niwota.com/nb/chenchuang?cat_self_id=291075<br /></span><img src ="http://www.aygfsteel.com/leekiang/aggbug/139844.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.aygfsteel.com/leekiang/" target="_blank">leekiang</a> 2007-08-27 11:58 <a href="http://www.aygfsteel.com/leekiang/archive/2007/08/27/139844.html#Feedback" target="_blank" style="text-decoration:none;">å‘表评论</a></div>]]></description></item></channel></rss> <footer>
<div class="friendship-link">
<a href="http://www.aygfsteel.com/" title="狠狠久久亚洲欧美专区_中文字幕亚洲综合久久202_国产精品亚洲第五区在线_日本免费网站视频">狠狠久久亚洲欧美专区_中文字幕亚洲综合久久202_国产精品亚洲第五区在线_日本免费网站视频</a>
</div>
</footer>
Ö÷Õ¾Ö©Öë³ØÄ£°å£º
<a href="http://" target="_blank">½ðÃÅÏØ</a>|
<a href="http://" target="_blank">¸»´¨</a>|
<a href="http://" target="_blank">ÏæÏçÊÐ</a>|
<a href="http://" target="_blank">Áú´¨ÏØ</a>|
<a href="http://" target="_blank">ÀË¿¨×ÓÏØ</a>|
<a href="http://" target="_blank">¸ßÑôÏØ</a>|
<a href="http://" target="_blank">°ÍÌÁÏØ</a>|
<a href="http://" target="_blank">ׯÀËÏØ</a>|
<a href="http://" target="_blank">»ÆæèÊÐ</a>|
<a href="http://" target="_blank">ÃÜÔÆÏØ</a>|
<a href="http://" target="_blank">ÄϽ§</a>|
<a href="http://" target="_blank">ÑôÔÏØ</a>|
<a href="http://" target="_blank">¾®ÚêÏØ</a>|
<a href="http://" target="_blank">ËÞǨÊÐ</a>|
<a href="http://" target="_blank">°¢°Í¸ÂÆì</a>|
<a href="http://" target="_blank">Îñ´¨</a>|
<a href="http://" target="_blank">ÉêÔúÏØ</a>|
<a href="http://" target="_blank">Íþº£ÊÐ</a>|
<a href="http://" target="_blank">ËÕÄáÌØÓÒÆì</a>|
<a href="http://" target="_blank">¸»´¨</a>|
<a href="http://" target="_blank">¼òÑôÊÐ</a>|
<a href="http://" target="_blank">ÏÉÓÎÏØ</a>|
<a href="http://" target="_blank">À³ÑôÊÐ</a>|
<a href="http://" target="_blank">ÌìË®ÊÐ</a>|
<a href="http://" target="_blank">µ±ÐÛÏØ</a>|
<a href="http://" target="_blank">ͨºÓÏØ</a>|
<a href="http://" target="_blank">ÌÚ³åÏØ</a>|
<a href="http://" target="_blank">Ëç·ÒºÓÊÐ</a>|
<a href="http://" target="_blank">Çì³ÇÏØ</a>|
<a href="http://" target="_blank">¿¦À®Ç߯ì</a>|
<a href="http://" target="_blank">ÄÚ½ÊÐ</a>|
<a href="http://" target="_blank">ʯ¼ÒׯÊÐ</a>|
<a href="http://" target="_blank">º×±ÚÊÐ</a>|
<a href="http://" target="_blank">¶¨±ßÏØ</a>|
<a href="http://" target="_blank">°²ÐÂÏØ</a>|
<a href="http://" target="_blank">ÈÄÑôÏØ</a>|
<a href="http://" target="_blank">³¤´ºÊÐ</a>|
<a href="http://" target="_blank">ÕÄÆ½ÊÐ</a>|
<a href="http://" target="_blank">ÒåÎÚÊÐ</a>|
<a href="http://" target="_blank">ÁÙ°²ÊÐ</a>|
<a href="http://" target="_blank">³çÀñÏØ</a>|
<script>
(function(){
var bp = document.createElement('script');
var curProtocol = window.location.protocol.split(':')[0];
if (curProtocol === 'https') {
bp.src = 'https://zz.bdstatic.com/linksubmit/push.js';
}
else {
bp.src = 'http://push.zhanzhang.baidu.com/push.js';
}
var s = document.getElementsByTagName("script")[0];
s.parentNode.insertBefore(bp, s);
})();
</script>
</body>