mirror of
https://github.com/ReaJason/MemShellParty.git
synced 2026-09-23 23:41:52 +08:00
fix: glassfish upload error
This commit is contained in:
-1
@@ -60,7 +60,6 @@ public class GlassFish3ContainerTest {
|
|||||||
@AfterAll
|
@AfterAll
|
||||||
static void tearDown() {
|
static void tearDown() {
|
||||||
String logs = container.getLogs();
|
String logs = container.getLogs();
|
||||||
log.info(logs);
|
|
||||||
assertThat("Logs should not contain any exceptions", logs, doesNotContainException());
|
assertThat("Logs should not contain any exceptions", logs, doesNotContainException());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -35,7 +35,11 @@ public class UploadServlet extends HttpServlet {
|
|||||||
for (FileItem item : items) {
|
for (FileItem item : items) {
|
||||||
if (!item.isFormField()) {
|
if (!item.isFormField()) {
|
||||||
String fileName = new File(item.getName()).getName();
|
String fileName = new File(item.getName()).getName();
|
||||||
String uploadPath = getServletContext().getRealPath(UPLOAD_DIRECTORY) + File.separator + fileName;
|
String uploadFolder = getServletContext().getRealPath(UPLOAD_DIRECTORY);
|
||||||
|
if (!uploadFolder.endsWith(File.separator)) {
|
||||||
|
uploadFolder += File.separator;
|
||||||
|
}
|
||||||
|
String uploadPath = uploadFolder + fileName;
|
||||||
File uploadFile = new File(uploadPath);
|
File uploadFile = new File(uploadPath);
|
||||||
item.write(uploadFile);
|
item.write(uploadFile);
|
||||||
response.getWriter().println("file upload success: " + uploadPath);
|
response.getWriter().println("file upload success: " + uploadPath);
|
||||||
|
|||||||
Reference in New Issue
Block a user