CodeCharge Studio
search Register Login  

Visual PHP Web Development

Visually Create Internationalized Web Applications, Web Reports, Calendars, and more.

YesSoftware Forums -> CodeCharge Studio -> Java

 file upload problem Help pls JSP/JAVA

Print topic Send  topic

Author Message

Posts: 4
Posted: 07/07/2008, 12:09 AM

I can

File file = new file ("d:/new.jpg ")

and insert into oracle db

but now I want to select jpg than insert into my oracle db

<input type="file" name="uploadfile"> - like that

but I can't get location and get file. how I do pls help
View profile  Send private message

Posts: 10
Posted: 07/07/2008, 10:54 AM

You should implement a different servlet, and use it to read the file from the database and send it through the http response.

In your pages you shoud call your image like that:

<input type="file" name="uploadfile" src="getImage?imageid">

View profile  Send private message

Posts: 4
Posted: 07/07/2008, 7:50 PM

My Jsp page:

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@include file="../WEB-INF/taglibs.jsp" %>

<stripes:layout-render name="/themes.jsp" pageTitle="Content">
<stripes:layout-component name="t.jsp">
<stripes:form action="/upload.action">
<stripes:label for="">Pic name</stripes:label>
<input type="file" name = "pic">

<stripes:submit name="insert" value="add" />

java page :__________________________________

public class UploadBean extends CrimeActionBean {

private File pic;
public Resolution insert() {

BaseDAO myConn = new BaseDAO();
Connection conn = null;

conn = myConn.getConnection();
PreparedStatement ps = null;

try {

File file = new File(getPic().getPath()); - this is my my problem. I can't get file and file location. If I can get file than I will be insert into my Db. How do i decide this problem.

System.out.println(" location " + getPic().getPath());

FileInputStream fis = new FileInputStream(file);
ps = conn.prepareStatement("insert into pics(byrtgelId, pic) values (?,?)");
ps.setInt(1, 121212);
ps.setBinaryStream(2, fis, (int) file.length());

} catch (Exception e) {
System.out.println("file upload exception: " + e.getMessage());
return new RedirectResolution("/upload.action");


View profile  Send private message

Posts: 386
Posted: 07/14/2008, 5:27 AM

Where is Codecharge relationship?
Matheus Trevizan

Dynamix Software Ltda.
Blumenau SC Brasil
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

Internet Database

Visually create Web enabled database applications in minutes.

Home   |    Search   |    Members   |    Register   |    Login

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