<FORM METHOD="POST" ACTION="infoJspInserts.jsp" ENCTYPE="multipart/form-data" name="form">
<INPUT TYPE="FILE" NAME="FILE1" SIZE="40"><BR>
<INPUT TYPE="Submit" VALUE="上传" ><%@ page contentType="text/html; charset=utf-8" %><%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<html>
<head>
<title>utf-8 upload page</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
</head>
<body>
<html:form action="upload-submit.do" enctype="multipart/form-data">Please enter some text, just to demonstrate the handling of text elements as opposed to file elements:
<br />
<html:text property="theText" />
<br />
<br />Please select the file that you would like to upload:
<br />
<!--html:file property="theFile" /-->
<input type =file name="theFile">
<br />
<br />If you would rather write this file to another file, please check here:
<html:checkbox property="writeFile" />
<br />
<br />If you checked the box to write to a file, please specify the file path here:
<br />
<html:text property="filePath" />
<br />
<br />
<html:submit /></html:form>
</body>
</html>
为什么我写的代码浏览文件后上传不了呢?请高手指教
<INPUT TYPE="FILE" NAME="FILE1" SIZE="40"><BR>
<INPUT TYPE="Submit" VALUE="上传" ><%@ page contentType="text/html; charset=utf-8" %><%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<html>
<head>
<title>utf-8 upload page</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
</head>
<body>
<html:form action="upload-submit.do" enctype="multipart/form-data">Please enter some text, just to demonstrate the handling of text elements as opposed to file elements:
<br />
<html:text property="theText" />
<br />
<br />Please select the file that you would like to upload:
<br />
<!--html:file property="theFile" /-->
<input type =file name="theFile">
<br />
<br />If you would rather write this file to another file, please check here:
<html:checkbox property="writeFile" />
<br />
<br />If you checked the box to write to a file, please specify the file path here:
<br />
<html:text property="filePath" />
<br />
<br />
<html:submit /></html:form>
</body>
</html>
为什么我写的代码浏览文件后上传不了呢?请高手指教
解决方案 »
- java中有没有 将JTextArea 内的文本全复制到系统剪贴板的方法?我查遍API,就只有将选中文本复制的copy方法
- [紧急求助]java控制台找不到资源
- jsp连接数据库mysql问题
- 问个integer包装类的问题
- 《think in java》里有关static和preference
- Java书籍问题
- java后面跟-Xrunhprof:cpu=times是什么意思啊?
- 构造器
- Socket的问题
- 请问那里有robot(网络搜索机器人)的源代码当?
- 网上冲照片的java程序.请问谁有源代码小弟急用
- 在linux下用java命令运行一个JFrame程序 ,但是却抛出不能与X Windows联接的异常,请问该怎么办?重分酬谢
Action中的的操作,struts 自带的example示例程序中有upload的示例
到 Apache 站点上看, 真简单, 你只要写十几行,就能把 field 和 file 都抽出来.