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>
ZJI发布了9月份促销信息,针对香港华为云线路物理服务器华为一型提供立减300元优惠码,优惠后香港华为一型月付仅450元起。ZJI是原来Wordpress圈知名主机商家:维翔主机,成立于2011年,2018年9月更名为ZJI,提供中国香港、台湾、日本、美国独立服务器(自营/数据中心直营)租用及VDS、虚拟主机空间、域名注册等业务,商家所选数据中心均为国内访问质量高的机房和线路,比如香港阿里云、华为...
2021年6月底,raksmart开发出来的新产品“cloud-云服务器”正式上线对外售卖,当前只有美国硅谷机房(或许以后会有其他数据中心加入)可供选择。或许你会问raksmart云服务器怎么样啊、raksm云服务器好不好、网络速度快不好之类的废话(不实测的话),本着主机测评趟雷、大家受益的原则,先开一个给大家测评一下!官方网站:https://www.raksmart.com云服务器的说明:底层...
说明一下:gcorelabs的俄罗斯远东机房“伯力”既有“Virtual servers”也有“CLOUD SERVICES”,前者是VPS,后者是云服务器,不是一回事;由于平日大家习惯把VPS和云服务器当做一回事儿,所以这里要特别说明一下。本次测评的是gcorelabs的cloud,也就是云服务器。 官方网站:https://gcorelabs.com 支持:数字加密货币、信用卡、PayPal...