Two Laptop Bag*
The moose likes Struts and the fly likes How Save File in Directory and path of the file in database using Struts 2.0 and Ejb 3.0 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "How Save File in Directory and path of the file in database using Struts 2.0 and Ejb 3.0" Watch "How Save File in Directory and path of the file in database using Struts 2.0 and Ejb 3.0" New topic
Author

How Save File in Directory and path of the file in database using Struts 2.0 and Ejb 3.0

Deepak Kumar pandey
Greenhorn

Joined: Aug 31, 2010
Posts: 11
Hi.......

I have save the file in directory. before saving the file i have to also check directory for particular file is exist or no.
if exist save the file in existing directory and if no then create new directory and save the file.

Also i want to know how give file name when saving.

please help me.

thanks
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Welcome to JavaRanch!

It's not clear what you're asking; how to upload files? How to use basic Java file IO?
Deepak Kumar pandey
Greenhorn

Joined: Aug 31, 2010
Posts: 11
David Newton wrote:Welcome to JavaRanch!

It's not clear what you're asking; how to upload files? How to use basic Java file IO?


I have to save file in directory and path of the file in data base using struts 2.0.
Also create directory if not exist.
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

So there are several parts to this task. I need to know which parts you're having problems with.

1) Upload a file (the only Struts-related problem)
2) Using Java to determine if a file exists
3) Writing information to a database

They're all different, they're all completely unrelated, and only item 1) is Struts-related.

See the Struts 2 FAQ entry about uploading files and the Struts 2 file upload page for item 1).

For the rest, I'd ask 2) in the beginning Java forum. For 3) it depends on how you're accessing the database, but either the JDBC forum, the ORM forum, or the Spring forum (or a different one if none of those cover what you're using).
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: How Save File in Directory and path of the file in database using Struts 2.0 and Ejb 3.0