我正在尝试从 HTML 文件输入上传文件。
我正在使用 Apache Commons FileUpload 并且文件上传成功。但是,当我尝试将文件路径存储在我的 MySQL 中时,它会在没有文件路径代码的情况下存储它:
String uploadFolder = getServletContext().getRealPath("/");
String fileName = new File(item.getName()).getName();
filePath = uploadFolder+"/"+fileName;
File uploadedFile = new File(filePath);
这就是我试图存储文件的方式。
存储的示例文件路径
C:UsersLashDesktopworkspace3.metadata.pluginsorg.eclipse.wst.server.core mp0wtpwebappsJavaECom/download doget.txt