upload.jsp
资源名称:wapjsp.rar [点击查看]
上传用户:xiao85513
上传日期:2010-01-11
资源大小:2160k
文件大小:2k
源码类别:
手机WAP编程
开发平台:
Java
- <%@ page import="org.apache.struts.action.*,
- java.util.Iterator,
- org.apache.struts.webapp.upload.UploadForm"%>
- <%@ page language="java" %>
- <%@ taglib uri="/WEB-INF/tld/struts-html.tld" prefix="html" %>
- <%@ taglib uri="/WEB-INF/tld/struts-logic.tld" prefix="logic" %>
- <%@ taglib uri="/WEB-INF/tld/struts-bean.tld" prefix="bean" %>
- <head><title>上传</title></head>
- <!-- Find out if the maximum length has been exceeded. -->
- <logic:present name="<%= Action.ERROR_KEY %>" scope="request">
- <%
- ActionErrors errors = (ActionErrors) request.getAttribute(Action.ERROR_KEY);
- //note that this error is created in the validate() method of UploadForm
- Iterator iterator = errors.get(UploadForm.ERROR_PROPERTY_MAX_LENGTH_EXCEEDED);
- //there's only one possible error in this
- ActionError error = (ActionError) iterator.next();
- pageContext.setAttribute("maxlength.error", error, PageContext.REQUEST_SCOPE);
- %>
- </logic:present>
- <!-- If there was an error, print it out -->
- <logic:present name="maxlength.error" scope="request">
- <font color="red"><bean:message name="maxlength.error" property="key" /></font>
- </logic:present>
- <logic:notPresent name="maxlength.error" scope="request">
- <font color=red>图片/铃声上传的大小不能超过2M--</font>
- </logic:notPresent>
- <!--
- The most important part is to declare your form's enctype to be "multipart/form-data",
- and to have a form:file element that maps to your ActionForm's FormFile property
- -->
- <html:form action="upload.do?queryParam=Successful" enctype="multipart/form-data">
- 上传图片/铃声:
- <html:checkbox property="writeFile" onclick="document.all.item('hehe').style.display=document.all.item('hehe').style.display==''?'none':'';"/><br /><br />
- <div style="display:none" id=hehe>请选择上传路径:<html:file property="theFile" /><html:submit value="上传"/><br /><br /></div>
- <%java.util.Date t=new java.util.Date();String tt=t.toLocaleString();while(tt.indexOf(":")>0)tt=tt.replace(':','-');while(tt.indexOf(" ")>0)tt=tt.replace(' ','-');%>
- <%tt="D:\ewapnew\picring\upload\"+tt;%>
- <div style="display:none"><html:text property="filePath" value="<%=tt%>" /><br /><br /></div>
- </html:form>