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>
韩国服务器怎么样?韩国云服务器租用推荐?韩国服务器距离中国近,有天然的地域优势,韩国服务器速度快而且非常稳定!有不少有亚洲市场的外贸公司选择韩国服务器开拓业务,韩国服务器因自身的优势也受到不少用户的青睐。目前的IDC市场上,韩国、香港、美国三个地方的服务器几乎占据了海外服务器的百分之九十以上。韩国服务器相比美国服务器来说速度更快,而相比香港机房来说则带宽更充足,占用市场份额非常大。那么,韩国服务器...
蓝竹云怎么样 蓝竹云好不好蓝竹云是新商家这次给我们带来的 挂机宝25元/年 美国西雅图云服务器 下面是套餐和评测,废话不说直接开干~~蓝竹云官网链接点击打开官网江西上饶挂机宝宿主机配置 2*E5 2696V2 384G 8*1500G SAS RAID10阵列支持Windows sever 2008,Windows sever 2012,Centos 7.6,Debian 10.3,Ubuntu1...
在2014年发现原来使用VPS的客户需求慢慢的在改版,VPS已经不能满足客户的需求。我们开始代理机房的独立服务器,主推和HS机房的独立服务器。经过一年多的发展,我们发现代理的服务器配置参差不齐,机房的售后服务也无法完全跟上,导致了很多问题发生,对使用体验带来了很多的不便,很多客户离开了我们。经过我们慎重的考虑和客户的建议。我们在2015开始了重大的改变, 2015年,我们开始计划托管自己...