问题描述:
String path = request.getRealPath("/budget/bugetUpload") + "\\"+ fileName;
FileOutputStream fs = new FileOutputStream(path);
在windows中没问题,在linux中不能创建文件,也不报错,原因是linux不能识别 \
现改为:
String path = request.getRealPath(File.separator+"budget"+File.separator+"bugetUpload") + File.separator
+ fileName;
File.separator能够根据当前系统自动识别,在
windows是\,unix是/