upfile.jsp
<form method="post"action="uploadimage.jsp"na me="form1"e n ctype="multipart/for m-data">
<input type="file"n a m e="file">
<input type="submIT" name="sub"value="upload">
</for m>
<form method="post"action="uploadimage.jsp"na me="form1"e n ctype="multipart/for m-data">
<input type="file"n a m e="file">
<input type="sub mit"na me="sub"value="upload">
</for m>
<STRONG><FONT color=#ff0000>uploadimage.jsp</FONT>
</STRONG>uploadimage.jsp
<PRE class=java.name="code">
< % @ page language="java"pageEncoding="gb2312"% >
< % @ pageimport="java.io.*,java.awt.image.*,com.sun.image.codec.jpeg.*,java.sql.*,com.jspsmart.upload.*,java.util.*"% >
< % @ page import="mainClass.*"% >
<ht ml>
<head>
<title>My JSP'uploadimage.jsp' starting page</title>
</head>
<body>
< %
SmartUpload sma =new SmartUpload( ) ;long file_max_size = 4000000;
String filename1 = "",ext= "",testvar= "";
String url= "uploadfiles/";sma.initialize(pageContext) ;try
{s ma.setAllowedFilesList("jpg,gif");sma.upload( ) ;
}catch (Exception e) {
% >
<script language="jscript">alert("只允许上传jpg,gif格式图片");window.location.href="upfile.jsp"
</script>
< %
}try{com.jspsmart.upload.Filemyf= sma.getFiles() .getFile(0) ;if(myf.is Missing() ) {
% >
<script language="jscript">alert("请选择要上传的文件 ");window.location.href="upfile.jsp"
</script>
< %
}el s e {ext=myf.getFileExt() ;int file_size=m yf.getSize() ;
String saveurl= "";if(file_siz e < file_m a x_siz e) {
C alendar cal= C alendar.getInstance( ) ;
String filename = String.valueOf(cal.getTimeInMills() ) ;saveurl= request.getRe alPath("/") + url;saveurl+= filena me + "."+ ext;myf.saveAs(saveurl, sma. SAVE_PHYSICAL) ;myclassmc =new myclass(request
.getRealPath("data/data.mdb") );mc
.executeInsert("insert into [path]values('uploadfiles/"+ filename + "."+ ext+ "' )");//检查o ut.println("图片上传成功 ");response.sendRedirect("showimg.jsp");
}
}
}catch (Exception e) {e.print StackTrace( ) ;
}
% >
</body></ht ml></PRE>
美国知名管理型主机公司,2006年运作至今,虚拟主机、VPS、云服务器、独立服务器等业务全部采用“managed”,也就是人工参与度高,很多事情都可以人工帮你处理,不过一直以来价格也贵。也不知道knownhost什么时候开始运作无管理型业务的,估计是为了扩展市场吧,反正是出来较长时间了。闲来无事,那就给大家介绍下“unmanaged VPS”,也就是无管理型VPS,低至5美元/月,基于KVM虚拟,...
justhost怎么样?justhost服务器好不好?JustHost是一家成立于2006年的俄罗斯服务器提供商,支持支付宝付款,服务器价格便宜,200Mbps大带宽不限流量,支持免费更换5次IP,支持控制面板自由切换机房,目前JustHost有俄罗斯6个机房可以自由切换选择,最重要的还是价格真的特别便宜,最低只需要87卢布/月,约8.5元/月起!总体来说,性价比很高,性价比不错,有需要的朋友可以...
上次部落分享过VirMach提供的End of Life Plans系列的VPS主机,最近他们又发布了DEDICATED MIGRATION SPECIALS产品,并提供6.5-7.5折优惠码,优惠后最低每月27.3美元起。同样的这些机器现在订购,将在2021年9月30日至2022年4月30日之间迁移,目前这些等待迁移机器可以在洛杉矶、达拉斯、亚特兰大、纽约、芝加哥等5个地区机房开设,未来迁移的时...