2013年12月10日星期二

strtus2 upload files to the linux server problems

In this case to ask the question: After struts2 file upload local variety of tests are no problem, but will project onto the linux server , upload files indicating success , the data is also written to the data , but the file upload is specified in linux under the directory did not, I would like to know the great God who encountered such a problem or know the cause of the problem, please tell brother ! Greatly appreciated ! (Ps: write permissions on the server directory to upload files have all been turned on )
------ Solution ------------------------ --------------------
you go tomcat bin folder to see if there is not ?

------ Solution ------------------------------------ --------
String appName = request.getContextPath (); name of the project
Road King is also the current
".. / webapps" + appName + "/ back plus upload your goals can be a Road King


------ Solution ------------------------------------ --------
see how you store the path is set , for example, whether the linux under the same kind of delimiters such as
------ Solution ------- ------------------------------------- problem
estimated path , you test in windows on it?
whether to write the absolute path , for example, contains the letter C / D xxx
delimiter is correct , it is recommended to use the / , because under linux, windwos common
------ Solution --------------------- -----------------------
write file path problem. debug it. Note separator under linux /
------ For reference only ------------------------------- code --------
my store path : savePath = ServletActionContext.getRequest () getRealPath ("");.
savePath = savePath + "/ uploads /";
dead did not write into D: \ \, C: \ \ What
------ For reference only ------------------ ---------------------

I started testing of the project is to test the local windows system
---- - For reference only ---------------------------------------
call ~ Solution the ! Brother wrote the code problem ah ! file.renameto in the windows is the same directory rename files, move files in different directories on , but linux is useless ! So you can not use file upload renameto this method

没有评论:

发表评论