vignesh
vignesh

Reputation: 1599

Uploading multiple files using file upload control in apache tomcat

I am new to apache tomcat. I am running apache tomcat in my windows machine.I am having a html containing file upload control.Using that i should allow others to upload documents.I am having another div in same html to list the uploaded files. While listing the files, i want to display the ip address from where its uploaded. Note the uploaded documents should store in my local drive. Guide me in doing this..

I want to know how to add servlet and jsp in apache tomcat and how to call it form html. Thanks in advance...

Upvotes: 2

Views: 1411

Answers (2)

Jigar Joshi
Jigar Joshi

Reputation: 240956

Hints:

Upvotes: 1

Nirmal- thInk beYond
Nirmal- thInk beYond

Reputation: 12064

you can get ip in servlet by

// This method is called by the servlet container to process a GET request.
public void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException {
    // Get client's IP address
    String addr = req.getRemoteAddr(); // 123.123.123.123

    // Get client's hostname
    String host = req.getRemoteHost(); // hostname.com
}

and you can show in html page, you can save in database as wel

Upvotes: 1

Related Questions