You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Debendra Barik <on...@yahoo.com> on 2006/02/08 12:20:54 UTC

help for file upload

Hello,
can anybody help me, i have a problem in uploading file into mysql database.
I am not getting the right way how to do it.
Here i am giving some details about my ActionForm, javaBean and database table

//CompanyForm(ActionForm) has a member variable and setter/getter
private FormFile logo;
Public void setLogo(FormFile logo){
this.logo=logo;
}
public getLogo(){
return logo;
}

//javaBean
Company.java
private byte logo[];
setter
public setLogo(byte[] logo){
this.logo=logo;
}
public getLogo(){
return logo
}


Database Table name is company has field like:
logo Blob;

//java class directly communicating with database
CompanyDB{

Company getCompany(); // get company details from database and return a company object
insertCompany(Company company) // insert company into database, taking a company object.
}


Now the matter is how do i store uploaded file into company bean logo filed and send it to the database by calling nsertCompany(Company company) method. And again how do i retrive it and store in the CompanyAction form logo field to show in the GUI.
Anybody can suggest me about if any better way have to do it.
Thanks,
Debendra.

		
---------------------------------
Brings words and photos together (easily) with
 PhotoMail  - it's free and works with Yahoo! Mail.