mySmartUpload.initialize(pageContext);// Initialization mySmartUpload.setAllowedFilesList("htm,html,txt,jpg,java,gif,,");// Only allow txt or htm files;"htm,html,txt,jpg,java,,"
// mySmartUpload.setDeniedFilesList("exe,bat,jsp");// DeniedFilesList can also be used :
// mySmartUpload.setMaxFileSize(50000);// Only allow files smaller than 50000 bytes
// mySmartUpload.setTotalMaxFileSize(200000);// Deny upload if the total fila size is greater than 200000 bytes
mySmartUpload.upload();// Upload try {// Save the files with their original names in a virtual path of the web server // Save the files with their original names in the virtual path "/upload" // count = mySmartUpload.save("/upload", mySmartUpload.SAVE_VIRTUAL);
// Save the files with their original names in the virtual path "/upload" // if it doesn't exist try to save in the physical path "/upload" count = mySmartUpload.save(uploadpath);
申请地址: http://java.isavvix.com/index.jsp 访问形式: http://member.isavvix.com/用户名 空间情况: 10M jsp+jdbc+xml+WAP web上传 申请攻略: 1、进入 http://java.isavvix.com/index.jsp 看到上边有登陆文本框的下边有 sign up,点他,进入申请叶面。 2、填写信息 User Name..................用户名 Password...................密码 Re-enter Password...................重复密码 First Name.................名 Last Name...................姓 E-mail Address.............邮箱 Re-enter Email Address..............重复邮箱 Company Name......................公司名称 Company Location ...........City...........城市 ...........U.S. State.....美国州(不选) ...........or- Non U.S.:..非美国的省或州 ...........Country/Region..国家 ...........Postal/Zip Code.邮政编码 Company Size.....................公司大小(随便选) Products Your Organization Uses........用什么来开发(其中有几个组,按住Ctrl,在里面随便选择,但是应该是每一个组都要选) 剩下的随便选择 Your IT Experience (Since Year).............年份 比如1987 How did you hear about the iSavvix Community? ........随便选一个,不要不选 然后,按sign up 注册,过一会,就会收到信,点信里面最长的那个连接激活网站。 3、管理网站: 在 http://java.isavvix.com/index.jsp 登陆 然后在 http://java.isavvix.com/devspace/index.jsp 管理文件 4、数据库 这个空间数据库是InstantDB,是一种用java编的数据库,是免费的不过前提是非商业应用,非政府应用。但是sql语法好像同Access很象,所以以前很长一段时间我还以为是Access呢。关于InstantDB的具体介绍请看官方其网站的文档: http://www.lutris.com/products/instantDB/software/documentation/idb4_0/install.html
html:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD><TITLE>发邮件</TITLE>
<META http-equiv=Content-Type content="text/html; charset=gb2312">
<LINK href="style.css" rel=stylesheet>
</HEAD>
<BODY text=#009900 bgColor=#ffffff >
<form method="post" name=form123 enctype="multipart/form-data" action="/pathweb/web/javamail/upload.jsp">
<TD><INPUT TYPE="FILE" NAME="FILE1" SIZE="45">
<INPUT type="submit" value="发 送" name="send" > </TD></TR>
</FORM>
</HTML>
jsp:
<%@ page language="java" import="com.jspsmart.upload.*"%>
<jsp:useBean id="mySmartUpload" scope="page" class="com.jspsmart.upload.SmartUpload" />
<%
String uploadpath="c:/upload";//设定上传文件目录
%>
<%
int count=0; // Variables
mySmartUpload.initialize(pageContext);// Initialization
mySmartUpload.setAllowedFilesList("htm,html,txt,jpg,java,gif,,");// Only allow txt or htm files;"htm,html,txt,jpg,java,,"
// mySmartUpload.setDeniedFilesList("exe,bat,jsp");// DeniedFilesList can also be used :
// mySmartUpload.setDenyPhysicalPath(true);// Deny physical path
// mySmartUpload.setMaxFileSize(50000);// Only allow files smaller than 50000 bytes
// mySmartUpload.setTotalMaxFileSize(200000);// Deny upload if the total fila size is greater than 200000 bytes
mySmartUpload.upload();// Upload
try {// Save the files with their original names in a virtual path of the web server
// Save the files with their original names in the virtual path "/upload"
// count = mySmartUpload.save("/upload", mySmartUpload.SAVE_VIRTUAL);
// Save the files with their original names in the virtual path "/upload"
// if it doesn't exist try to save in the physical path "/upload"
count = mySmartUpload.save(uploadpath);
} catch (Exception e){
out.println("<b>Wrong selection : </b>" + e.toString()); }
// out.print(" = " + mySmartUpload.getFiles().getFile(0).getFileName() + " (" +mySmartUpload.getFiles().getFile(0).getSize()/1000 + "kb)"); // Display the number of files uploaded
// out.println(count + " file(s) uploaded.");
//out.print("<center><font color=red>getfname=" + dir0+ "</font></center>");
%>
<HTML>
<HEAD>
<TITLE></TITLE>
<!--<script language=JavaScript src="/pathweb/web/f5.js"></script>-->
</HEAD><BODY BGCOLOR="#FFFFFF" ></BODY>
</HTML>
没有该方法!!!
mySmartUpload.setToMaxFileSize(1000000);
应该为
mySmartUpload.setTotalMaxFileSize(1000000);
不好好看提示,,,!!!我以前一直用它的好久没用了。。
注意:应该建在当前文件下,建子文件夹upload
例:
你的两个html、JSP存放在\test下,则应该建一个\test\upload文件夹。。
理解了吧??介绍一个免费的JSP网站申请地址给你http://www.isavvix.com/我的网站在很久前也建了一个 http://member.isavvix.com/pmwb应该会申请吧??要不行的话找软件译一下
访问形式: http://member.isavvix.com/用户名
空间情况: 10M jsp+jdbc+xml+WAP web上传
申请攻略:
1、进入 http://java.isavvix.com/index.jsp 看到上边有登陆文本框的下边有 sign up,点他,进入申请叶面。
2、填写信息
User Name..................用户名
Password...................密码
Re-enter
Password...................重复密码
First Name.................名
Last Name...................姓
E-mail Address.............邮箱
Re-enter
Email Address..............重复邮箱
Company
Name......................公司名称
Company
Location
...........City...........城市
...........U.S. State.....美国州(不选)
...........or- Non U.S.:..非美国的省或州
...........Country/Region..国家
...........Postal/Zip Code.邮政编码
Company
Size.....................公司大小(随便选)
Products
Your
Organization
Uses........用什么来开发(其中有几个组,按住Ctrl,在里面随便选择,但是应该是每一个组都要选)
剩下的随便选择
Your IT
Experience
(Since Year).............年份 比如1987
How did you hear about the iSavvix Community? ........随便选一个,不要不选
然后,按sign up 注册,过一会,就会收到信,点信里面最长的那个连接激活网站。
3、管理网站:
在 http://java.isavvix.com/index.jsp 登陆
然后在 http://java.isavvix.com/devspace/index.jsp 管理文件
4、数据库
这个空间数据库是InstantDB,是一种用java编的数据库,是免费的不过前提是非商业应用,非政府应用。但是sql语法好像同Access很象,所以以前很长一段时间我还以为是Access呢。关于InstantDB的具体介绍请看官方其网站的文档:
http://www.lutris.com/products/instantDB/software/documentation/idb4_0/install.html