jsp+mysql或者jsp+oracle中存储处理图片的代码

<%@ page contentType="text/html;charset=GB2312"%>
<%@ page import= "java.util.*"%>
<HTML>
<BODY>
<p>
选择要上传的文件:<BR>
<FORM action="accept.jsp" method="post"enctype="multipart/form-data">
<INPUT type=FILE name="boy" size="38">
<BR>
<INPUT type="submit" name="g" value="
提交">
<%
Calendar calendar = null;
calendar = Calendar.getInstance();
int a = calendar.get(Calendar.YEAR);%>
<%
int b=calendar.get(Calendar.MONTH);
%>
<%
int c=calendar.get(Calendar.DAY_OF_MONTH) ;
int e=calendar.get(Calendar.HOUR_OF_DAY);
int f=calendar.get(Calendar.MINUTE);
int g=calendar.get(Calendar.SECOND);
%>
<%=a%>

<%=b%>

<%=c%>

<%=e%>
小时
<%=f%>

<%=g%>

</BODY>
</HTML>

<%@ page contentType="text/html;charset=GB2312"%>
<%@ page import="java.io.*"%>
<%@ page import= "java.util.*"%>
<HTML>
<BODY>
<%
Calendar calendar = null;
calendar = Calendar.getInstance();
int a = calendar.get(Calendar.YEAR);%>
<%
int b1=calendar.get(Calendar.MONTH)+1;
%>
<%
int c=calendar.get(Calendar.DAY_OF_MONTH) ;
int e=calendar.get(Calendar.HOUR_OF_DAY);
int f1=calendar.get(Calendar.MINUTE);
int g=calendar.get(Calendar.SECOND);
String aa=""+a+b1+c+e+f1+g+".rm";
String bb="a"+a;
String cc=""+b1;
String dd="d://"+bb+"//"+cc+"//";
%>
<%
try{InputStream in=request.getInputStream();
out.println("f1");
File f=new File(dd);
out.println(dd);
out.println(aa);
out.println("f2");
if(f.exists())
{
out.println("nodelete");
f.delete();
out.println("delete");
}
else
{
out.println("nomkdir");
f.mkdirs();
out.println("mkdirsok");
}
f= new File(dd,aa);
FileOutputStream o=new FileOutputStream(f);
PrintWriter pw = new PrintWriter(o);
out.println("f3");
byte b[]=new byte[1000];
int n;
BufferedReader br = new BufferedReader(new InputStreamReader(in));
String line = br.readLine();
out.println(line);
while(line!=null)
{//o.write(b,0,n);
pw.println(line);
line = br.readLine();
out.println(line);
}
o.close();
in.close();
pw.flush();
pw.close();
br.close();
out.print("
文件已经上传");
}
catch(Exception ee){
out.println(ee.getMessage());
ee.printStackTrace();
}

%>
</body>
</HTML>
阅读更多
想对作者说点什么? 我来说一句

JSP+Oracle 图书管理系统

2011年05月09日 1.37MB 下载

JSP+Oracle网上购物系统(含源代码)

2009年03月30日 3.39MB 下载

JSP+ORACLE网站实例(上)

2007年06月20日 5.02MB 下载

没有更多推荐了,返回首页

加入CSDN,享受更精准的内容推荐,与500万程序员共同成长!
关闭
关闭