CodeCharge Studio
search Register Login  

Visual Web Reporting

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> Java

 How to upload a file from html page to database using jsp programming.

Print topic Send  topic

Author Message
balaji_budhu

Posts: 1
Posted: 10/10/2007, 12:07 AM

Hi All :-)
How to upload a file from html page to database using jsp programming.

i have created a table called task_table with a field (up BLOB) as BLOB data type.

***source.html***
<input type="file" name="attach">

***up.jsp***
<%
java.io.File f=new java.io.File("attach");
java.io.FileInputStream fis= new java.io.FileInputStream(f);
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con=DriverManager.getConnection("jdbc:odbc:balaji","admin","qsg");
PreparedStatement pst=con.prepareStatement("insert into task_table values(?)");
pst.setBinaryStream(1,fis,(int)f.length());
pst.executeUpdate();
pst.close();
con.close();
%>
I am not able to upload a file to sql database.
I am not sure this approach is correct or not..
Please help me any one to come out of this problem...its very urgent for me

Thank you,
Balaji


_________________
Thanks&Regards,
Balaji
View profile  Send private message

Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

Web Database

Join thousands of Web developers who build Web applications with minimal coding.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright 2003-2004 by UltraApps.com  and YesSoftware, Inc.