Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Struts 2 FileUpload working locally but not on server

 
Katie Doody
Ranch Hand
Posts: 90
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 90
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 90
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ironically, if you check theFile.length() > 0 (wrong) rather than getUpload().length() > 0 it will work on occasion but not consistently.
 
sergio labarta
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
katie I am sergio, please email me
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic