upload file problem in java

When defining the upload file path in java, we try to use "/" to divide the path instead of "\\". Because when we deploy to Linux system, "\\" will be parsed as "/" string as the file name. So after uploading and then downloading, the path will not be found.

Such as:

String ctxPath = request.getSession().getServletContext().getRealPath("/") + "upload/" + userName + "/";

 

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326573268&siteId=291194637