aspose file tools*
The moose likes Java in General and the fly likes Need help in looping Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » Java in General
Reply locked New topic

Need help in looping

pankaj semwal
Ranch Hand

Joined: Oct 07, 2008
Posts: 300

Below is my code for putting multiple file to the sever.

But it overwrite the name and the content of the files with last one.

Please tell me where i am wrong

Paul Sturrock

Joined: Apr 14, 2004
Posts: 10336

You define your variable "theFile" outside the loop where you assign a value to it, so it will overwrite each time the loop loops.

JavaRanch FAQ HowToAskQuestionsOnJavaRanch
David Newton

Joined: Sep 29, 2008
Posts: 12617

This question was already answered multiple times in your original posting.
Campbell Ritchie

Joined: Oct 13, 2005
Posts: 36578
David Newton wrote:This question was already answered multiple times in your original posting.
I looked for a duplicate posting earlier, but missed it. Thank you David for pointing this out: closing thread.
I agree. Here's the link:
subject: Need help in looping
Similar Threads
How to rename and upload a file?
Struts 2 FileUpload working locally but not on server
multiple file upload in Strut2
how to display images on JSP in struts2
ENCTYPE='multipart/form-data and request.getParameter