jspsmartupload组建上传具体代码在jspsmartupload得例子里就有,看看吧

解决方案 »

  1.   

    GOOGLE 上搜呀
    大把这样的例子。
      

  2.   

    建议你不要把图片存到数据库存个url就可以了吧
      

  3.   

    oracle数据库,各位兄弟有没有好网址介绍一下,让我看看相关文章阿
    或者列出个程序DEMO阿,谢谢!
      

  4.   

    oracle有一种字段类型BLOB,可以存储图象,使用时需要以流的形式写入和读出,具体代码手头没有
      

  5.   

    //////////////////////////////////////////////////////////
    //插入文件
    import java.sql.*;public class InsertFileTest
    {
        String strDriverClass = "com.microsoft.jdbc.sqlserver.SQLServerDriver";
        String strUrl         = "jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=test";
        String strUser        = "sa";
        String strPsw         = "";    private Connection conn;    public InsertFileTest()
        {
            try
            { //引入要SqlServer的Jdbc数据库驱动
               Class.forName(strDriverClass).newInstance();
               //连接数据           conn = DriverManager.getConnection(strUrl,strUser,strPsw);
               String filePath = "C:\\dict\\index_dict.xml";
               java.io.File file = new java.io.File(filePath);
               java.io.FileInputStream ofis = new java.io.FileInputStream(filePath);//           String sql = "BULK INSERT bigfile(id,myxml,mytext) FROM ('1','C:\\dict\\index_dict.xml','C:\\dict\\index_dict.xml'";
               String sql = "SELECT TOP 0 code,myfile,size FROM filetest";
    //           CallableStatement statement = conn.prepareCall(sql);           Statement objStm = conn.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_UPDATABLE);           ResultSet ofRS = objStm.executeQuery(sql);
    //           ofRS.insertRow();
               ofRS.moveToInsertRow();
          //     ofRS.next();
               ofRS.updateString("code","index");
               ofRS.updateBinaryStream("myfile", ofis, (int)file.length());
               ofRS.updateInt("size",(int)file.length());
               //Clob clob = ofRS.getClob("myxml");
               //byte[] buf = new byte[(int)file.length()];
               //java.io.FileOutputStream fos = new java.io.FileOutputStream(file);
               //fos.write(buf);
               //clob.getAsciiStream().read(buf);           //ofRS.updateClob("myxml",clob);           ofRS.insertRow();
               ofRS.close();
               objStm.close();
               conn.close();
            }
            catch(Exception ex)
            {
              ex.printStackTrace();
            }
        }    public static void main(String[] args)
        {
            new InsertFileTest();
        }
    }//////////////////////////////////////////////////////////////
    //读取文件
    import java.sql.*;
    import java.io.*;public class ReadFile
    {    public ReadFile()
        {
        }    public static void main(String[] args)
        {
            String strDriverClass = "com.microsoft.jdbc.sqlserver.SQLServerDriver";
            String strUrl         = "jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=test";
            String strUser        = "sa";
            String strPsw         = "";
            Connection conn;
            try
            { //引入要SqlServer的Jdbc数据库驱动
                Class.forName(strDriverClass).newInstance();
                //连接数据
                conn = DriverManager.getConnection(strUrl,strUser,strPsw);
                String filePath = "C:\\dict\\index_dict_temp.xml";
                java.io.File file = new java.io.File(filePath);            if(!file.exists())
                {
    //           String sql = "BULK INSERT bigfile(id,myxml,mytext) FROM ('1','C:\\dict\\index_dict.xml','C:\\dict\\index_dict.xml'";
                    String sql = "SELECT code, myfile,size FROM filetest WHERE code='index'";
    //           CallableStatement statement = conn.prepareCall(sql);                Statement objStm = conn.createStatement();                ResultSet ofRS = objStm.executeQuery(sql);
                    String code = null;
                    int size = 0;
                    if(ofRS.next()) {
                        code = ofRS.getString("code");
                        size = ofRS.getInt("size");
                        System.out.println(code+" "+size);
                    }                ofRS = objStm.executeQuery(sql);
                    if(ofRS.next())
                    {
                        java.io.InputStream is = ofRS.getBinaryStream("myfile");
                        byte[] buf = new byte[size];
                        is.read(buf);                    FileOutputStream fos = new java.io.FileOutputStream(filePath);
                        fos.write(buf);                    System.out.println(new String(buf));
                    }                ofRS.close();
                    objStm.close();
                    conn.close();
                }
            }
            catch(Exception ex)
            {
                ex.printStackTrace();
            }
        }
    }
      

  6.   

    http://www.csdn.net/Develop/article/20%5C20484.shtm
    这里有一篇文章(不是我写的),大概对你有所帮助