客户端的图片上传到ORACLE数据库
我做了一个程序是根据上传文件的路径来取得数据流文件的在服务器端运行好使,客户端不可用
<%@ page contentType="text/html;charset=gb2312"%>
<%@ page import="java.sql.*" %>
<%@ page import="java.util.*"%>
<%@ page import="java.text.*"%>
<%@ page import="java.io.*"%>
<html>
<body>
<%
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
String url="jdbc:odbc:lx";
Connection conn= DriverManager.getConnection(url,"dba","sql");
String content=request.getParameter("content");
String filename=request.getParameter("image");
System.out.println(filename);
FileInputStream str=new FileInputStream(filename);
String sql="insert into image(id,content,image) values(3,?,?)";
PreparedStatement pstmt=conn.prepareStatement(sql);
pstmt.setString(1,content);
//public void setBinaryStream(int parameterIndex,
// InputStream x,
// int length)
//public int available()
// throws IOException
//Returns the number of bytes that can be read from this file input stream without blocking.
pstmt.setBinaryStream(2,str,str.available());
pstmt.execute();
out.println("Success,You Have Insert an Image Successfully");
%>
</body>
</html>
现在我想在客户端上传图片进库该如何写呀?