Home > Back-end >  Access to the uploaded files in the JSP page jue 'dui' lu 'jing
Access to the uploaded files in the JSP page jue 'dui' lu 'jing

Time:10-20

Upload files in the JSP screen, turn to the corresponding results in the servlet, how to get the absolute file path in the servlet

CodePudding user response:

After uploading the absolute path? Save position + file name

CodePudding user response:

Is the path of the upload before, now I get the upload of the file name, but don't get the file path + name of the file
 try {
List ListForms=upload. ParseRequest (request);
For (FileItem FileItem: listForms) {
//determine whether each form element common form

If (fileItem isFormField ()) {
System. The out. Println (fileItem. Get string (" utf-8 "));

} else {
The String fileName=fileItem. GetName ();

FileName=fileName. The substring (fileName. LastIndexOf (" \ \ ") + 1);
System.out.println(fileName);
}

}

} the catch (FileUploadException e) {

e.printStackTrace();
}
  • Related