Hello everyone, I'm trying to storing the user profile image into database.....that's why I'm develop the html code for browse and taking user image path into text field in html...NOW I'm stuct into that user path how can retrieve from html code to
java code for Storing that path image file into DB........Please help me out of this......
HTML code:-
<tr>
<td class="blog_text">File to Upload:</td>
<td>
<input size=38 TYPE="file" NAME="file">
</td>
</tr>
<td>
<input type=hidden name="serial_number" value="1234567890">
</td>
<td><input type="submit" name="button" id="button" value="Post" style="height: 25px; width:100px" action="SubmitData.action"/>
<input type="Reset" name="Reset" id="Reset" value="Reset" style="height: 25px; width:100px"/></td>
Java code:-- For using preparedstatement for storing user data into DB:-
Class.forName(DRIVER);
con1 = DriverManager.getConnection(URL+DB_Name,USERNAME,PASSWORD);
PreparedStatement ps = con1.prepareStatement("insert into post_detail values(?,?,?,?,?,?)");
con1.setAutoCommit(true);
System.out.println("commited Successfully ");
ps.setInt(1,bn2.getPost_id());
ps.setString(2, bn2.getUser_name());
ps.setString(3, bn2.getTitle());
ps.setString(4, bn2.getComment());
ps.setInt(5, bn2.getRating());
FileInputStream fin = new FileInputStream("E:/WORK/img/back.jpg");
ps.setBinaryStream(6,fin,fin.available());
status = ps.executeUpdate();
ps.close();
con1.close();
Thank You in Advance