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>
RAKsmart机房将于7月1日~7月31日推出“年中大促”活动,多重惊喜供您选择;爆款I3-2120仅30美金秒杀、V4新品上市,活动期间5折抢购、爆款产品持续热卖、洛杉矶+硅谷+香港+日本站群恢复销售、G口不限流量产品超低价热卖。美国VPS、日本VPS及香港VPS享全场7折优惠;爆款VPS $ 1.99/月限量秒杀,10台/天,售完即止, VPS 7折优惠码:VPS-TP-disRAKsmar...
在六月初的时候有介绍过一次来自中国台湾的PQS彼得巧商家(在这里)。商家的特点是有提供台湾彰化HiNet线路VPS主机,起步带宽200M,从带宽速率看是不错的,不过价格也比较贵原价需要300多一个月,是不是很贵?当然懂的人可能会有需要。这次年中促销期间,商家也有提供一定的优惠。比如月付七折,年付达到38折,不过年付价格确实总价格比较高的。第一、商家优惠活动年付三八折优惠:PQS2021-618-C...
tmhhost放出了2021年的端午佳节+618年中大促的优惠活动:日本软银、洛杉矶200G高防cn2 gia、洛杉矶三网cn2 gia、香港200M直连BGP、韩国cn2,全都是高端优化线路,所有这些VPS直接8折,部分已经做了季付8折然后再在此基础上继续8折(也就是6.4折)。 官方网站:https://www.tmhhost.com 香港BGP线路VPS ,200M带宽 200M带...