这是上传文件代码的相关java代码,我需要为文件名添加时间戳,然后将其上传到特定目录
public class Upload extends HttpServlet {
private static final long serialVersionUID = 1L;
public void init() throws ServletException {
System.out.println(this.getClass().getName());
}
protected void doPost(HttpServletRequest request,HttpServletResponse response) throws ServletException,IOException {
//boolean MultipartRequest;
//String PrintWriter;
response.setContentType("text/html");
PrintWriter out = response.getWriter();
MultipartRequest multipartRequest = new MultipartRequest(request,"/home/hadoop/Desktop");
out.println("succcesfully uploaded");
}
public void destroy() {
System.out.println(this.getClass().getName());
}
}