撰写时间:2019年2月1日
(说明:图片添加水印来自其他作者,并非本人原创)
原创作者:http://www.cnblogs.com/personnel/p/4582904.html
一、功能实现
// 这个路径相对应当前应用的目录
/*String uploadPath = req.getServletContext().getRealPath("/upload");*/
String uploadPath = "D:/112017Nian/项目/upload";
// 如果目录不存在则创建
File uploadDir = new File(uploadPath);
if (!uploadDir.exists()) {
uploadDir.mkdir();}
//添加水印▽
File file = new File(uploadPath + "/" + fileName);
if (!file.