This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Struts and the fly likes File Uploading Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "File Uploading" Watch "File Uploading" New topic

File Uploading

Joe Ridener
Ranch Hand

Joined: Jul 16, 2012
Posts: 86

I am in the middle of a tutorial on Struts II. Although I have gone all over trying to get this program up and running I am still having the same exact problem and would have to believe that it is common. The error is that the it is not setting the File object in my sub-class of ActionSupport. my server console almost always says

INFO: Unable to find 'struts.multipart.saveDir' property setting. Defaulting to javax.servlet.context.tempdir

My Struts XML says this:

My Java Source code

I just threw this together very quickly. In previous attempts i followed the fileUpload's naming conventions far more strictly and still had the same result. So even though many of you may mention this it is most likely not the problem.
Joe Ridener
Ranch Hand

Joined: Jul 16, 2012
Posts: 86
Oh yeah I forgot to mention that the File object is always null and does not exist.
Ulf Dittmer

Joined: Mar 22, 2005
Posts: 41137
I know little about Struts, but my first check would be that "javax.servlet.context.tempdir" points to a directory that can be read and written by whatever user account the servlet container runs under, and that no security manager interferes with that.

Ping & DNS - my free Android networking tools app
Joe Ridener
Ranch Hand

Joined: Jul 16, 2012
Posts: 86
Close ... turned out the problem was you have to nest the interceptor-ref's a certain way. But my program does run now. And yes I created an images directory and download to there and it is better.

I agree. Here's the link:
subject: File Uploading
Similar Threads
File name when using Struts 2 file upload
File is not uploaded using struts2
problem in file upload with struts 2?
Struts 2 Fileupload problem
Interceptor make chages which Unknown to us.