Logo 
Search:

Java Forum

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds

help regarding the file saving on server side

  Asked By: Alma    Date: Feb 04    Category: Java    Views: 2062
  

I want to develop an application that have to give an option to browse a file to client and then upload that file and on my (Server side) that file should be saved in the C:\\uploadedclientfiles and the db table should have the entry against every file that should be C:\\uploadedclientfiles\
filename but the main issue is that how can I save the file on the server side in any drive for future use.
please help me if any one have any idea.

Share: 

 

2 Answers Found

 
Answer #1    Answered By: Troy Kelley     Answered On: Feb 04

You have to create a config file, say, my-app-config.cfg.xml in which you put the path to the directory you want the uploaded files to be saved to.
the structure of your xml file  should be something like this:

<my-app>
<properties>
<property name="myapp.upload-path" value="/usr/opt/myapp/" />
</properties>
</my-app>

the given path above is in unix format.

so when your application  is starting up you are supposed to read the path from XML file and configure your application.

the simple way to create the config file is property files which may simply be read by Property resources

fiel name: myapp.properties
myapp.upload-path=c:/myfile/uploaded-files

 
Answer #2    Answered By: Gorkem Yilmaz     Answered On: Feb 04

U can use Apach Commons file  upload library
http://commons.apache.org/fileupload/
to upload  files to the server, saving  file is matter of opening output stream
and writing the uploaded file to that stream ...

 
Didn't find what you were looking for? Find more on help regarding the file saving on server side Or get search suggestion and latest updates.




Tagged: