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>
特网云为您提供高速、稳定、安全、弹性的云计算服务计算、存储、监控、安全,完善的云产品满足您的一切所需,深耕云计算领域10余年;我们拥有前沿的核心技术,始终致力于为政府机构、企业组织和个人开发者提供稳定、安全、可靠、高性价比的云计算产品与服务。官方网站:https://www.56dr.com/ 10年老品牌 值得信赖 有需要的请联系======================特网云推出多IP云主机...
蓝竹云怎么样 蓝竹云好不好蓝竹云是新商家这次给我们带来的 挂机宝25元/年 美国西雅图云服务器 下面是套餐和评测,废话不说直接开干~~蓝竹云官网链接点击打开官网江西上饶挂机宝宿主机配置 2*E5 2696V2 384G 8*1500G SAS RAID10阵列支持Windows sever 2008,Windows sever 2012,Centos 7.6,Debian 10.3,Ubuntu1...
2021年6月底,raksmart开发出来的新产品“cloud-云服务器”正式上线对外售卖,当前只有美国硅谷机房(或许以后会有其他数据中心加入)可供选择。或许你会问raksmart云服务器怎么样啊、raksm云服务器好不好、网络速度快不好之类的废话(不实测的话),本着主机测评趟雷、大家受益的原则,先开一个给大家测评一下!官方网站:https://www.raksmart.com云服务器的说明:底层...