| | |
| | | //上传机房视频接口
|
| | | public String uploadStationFile(){
|
| | | BattInf binf = getGson().fromJson(json, BattInf.class);
|
| | | String fileRoot = "staionsrc";
|
| | | String fileRoot = "stationsrc";
|
| | | ServiceModel model = new ServiceModel();
|
| | | boolean isSuccess = false;
|
| | | String loadpath = ActionUtil.getSession().getServletContext().getRealPath("/");
|
| | | String str = new File(loadpath).getParentFile().getAbsolutePath(); //获取服务器所在的绝对路径
|
| | | String root = str+"/"+fileRoot+"/"+binf.getStationId()+"/vide/"; // 上传路径
|
| | | String root = str+"/"+fileRoot+"/"+binf.getStationId()+"/video/"; // 上传路径
|
| | | for(int i=0;i<file.length;i++){
|
| | | String filePath = root+fileFileName[i];
|
| | | createFilefolderIFNotExist(filePath);
|
| | | copyFile(file[i], filePath);
|
| | | isSuccess = true;
|
| | | }
|
| | | if(isSuccess){
|
| | | model.setCode(1);
|
| | | model.setMsg("上传成功");
|
| | | }else{
|
| | | model.setCode(0);
|
| | | model.setMsg("上传失败");
|
| | | }
|
| | | result = tojson(model);
|
| | | return SUCCESS;
|
| | |
| | |
|
| | |
|
| | |
|
| | | public void setJson(String json) {
|
| | | this.json = json;
|
| | | }
|
| | |
|
| | | public static void main(String[] args) {
|
| | | String filePath = "D:/test/a/a.txt";
|
| | | ActionUtil.createFileRootIFNotExist(filePath);
|