File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Struts and the fly likes How to upload a file to sql server database using struts Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "How to upload a file to sql server database using struts" Watch "How to upload a file to sql server database using struts" New topic
Author

How to upload a file to sql server database using struts

Vidya Gupta
Ranch Hand

Joined: Mar 18, 2012
Posts: 96
Hi,

I am developing an application to upload a file to database.. Actually i don't know which data type to use in the database to store the file and how to store the file in database... please help me..

Thanks in advance
Lalitha.

this is my form bean,

LoginFormBean.java
-------------


I don't know which code to be written in action class to store the data.. please give me some suggestions..
Joe Ess
Bartender

Joined: Oct 29, 2001
Posts: 8708
    
    6

This isn't really a Struts problem. Your database field should be declared some sort of binary data type like RAW in Oracle. Java has a BLOB object that abstracts access to that type. FormFile has methods to get the file data. You should be able to put the pieces together.


"blabbing like a narcissistic fool with a superiority complex" ~ N.A.
[How To Ask Questions On JavaRanch]
Vidya Gupta
Ranch Hand

Joined: Mar 18, 2012
Posts: 96
please can any one tell me how to pass the file to any database..
Vidya Gupta
Ranch Hand

Joined: Mar 18, 2012
Posts: 96

In my action class i wrote,



I stucked here and i want to store the file in databse..

Please can anyone give me some hints to store it to database.. i am very new to struts..
Joe Ess
Bartender

Joined: Oct 29, 2001
Posts: 8708
    
    6

Lalitha Kotha wrote:
i am very new to struts..


Again, this has nothing to do with Struts. Did you look at the BLOB class?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to upload a file to sql server database using struts
 
Similar Threads
Mutiple File Uploading
how to set FormFile
File upload in struts
How to make FormFile return fully qualified file name?
Map the action form object