File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Struts and the fly likes Struts 2 FileUpload working locally but not on server Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Struts 2 FileUpload working locally but not on server" Watch "Struts 2 FileUpload working locally but not on server" New topic
Author

Struts 2 FileUpload working locally but not on server

Katie Doody
Ranch Hand

Joined: Nov 03, 2006
Posts: 90
Hello, I am using the file upload in struts 2 and it works perfectly on my local machine but when I deploy to the server it is not working. I have tried adding: struts.multipart.saveDir="/usr/local/jboss/server/default/work/jboss.web/localhost/easements" to the struts.properties but the path does not seem to make a difference.

The first time I go into the application and try to attach the document I can see the file being written and the log also shows this. I think it is the actual upload that is faling but there are no errors in the log.

Does anyone have any ideas?
Katie Doody
Ranch Hand

Joined: Nov 03, 2006
Posts: 90
Nevermind, it was my code and a stupid mistake. At first I was checking to make sure that the file had a value when I should have been checking to see if the upload had a value since I was creating a new file and copying the upload to this new file. Here is the corrected code:

Katie Doody
Ranch Hand

Joined: Nov 03, 2006
Posts: 90
Ironically, if you check theFile.length() > 0 (wrong) rather than getUpload().length() > 0 it will work on occasion but not consistently.
sergio labarta
Greenhorn

Joined: Oct 28, 2008
Posts: 2
katie I am sergio, please email me
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Struts 2 FileUpload working locally but not on server