public static State save(String content, Map<String, Object> conf) { byte[] data = decode(content); long maxSize = (Long) conf.get("maxSize"); if (!validSize(data, maxSize)) { return new BaseState(false, AppInfo.MAX_SIZE); } String suffix = FileType.getSuffix(FileType.JPG); try { FileService fileService = Context.FILE_SERVICE; String path = fileService.saveStaticFile(new ByteArrayInputStream(data), System.currentTimeMillis() + suffix); State state = new BaseState(true); state.putInfo("size", data.length); state.putInfo("title", ""); state.putInfo("url", path); state.putInfo("type", suffix); return state; } catch (Exception e) { log.error("上传base64文件失败",e); } return new BaseState(false, AppInfo.IO_ERROR); }
public final State doExec() { String filedName = (String) this.conf.get("fieldName"); State state; if ("true".equals(this.conf.get("isBase64"))) { state = Base64Uploader.save(this.request.getParameter(filedName), this.conf); } else { state = BinaryUploader.save(this.request, this.conf); } return state; } }
public final State doExec() { String filedName = (String) this.conf.get("fieldName"); State state = null; if ("true".equals(this.conf.get("isBase64"))) { state = new Base64Uploader(storage).save(this.request.getParameter(filedName), this.conf); } else { state = new BinaryUploader(storage).save(this.request, this.conf); } return state; } }
String filedName = (String) conf.get("fieldName"); if ("true".equals(conf.get("isBase64"))) { state = new Base64Uploader(storage).save(this.request.getParameter(filedName), conf); } else { state = new BinaryUploader(storage).save(this.request, conf);
public State save(String content, Map<String, Object> conf) { byte[] data = decode(content); long maxSize = ((Long) conf.get("maxSize")).longValue(); if (!validSize(data, maxSize)) { return new BaseState(false, AppInfo.MAX_SIZE); } String suffix = FileType.getSuffix("JPG"); String savePath = PathFormat.parse((String) conf.get("savePath"), (String) conf.get("filename")); savePath = savePath + suffix; String rootPath = (String) conf.get("rootPath"); State storageState = storage.saveBinaryFile(data, rootPath, savePath); if (storageState.isSuccess()) { storageState.putInfo("type", suffix); storageState.putInfo("original", ""); } return storageState; }
public final State doExec() { String filedName = (String) this.conf.get("fieldName"); State state = null; if ("true".equals(this.conf.get("isBase64"))) { state = Base64Uploader.save(this.request.getParameter(filedName), this.conf); } else { state = BinaryUploader.save(this.request, this.conf); } return state; } }
public static State save(String content, Map<String, Object> conf) { byte[] data = decode(content); long maxSize = ((Long) conf.get("maxSize")).longValue(); if (!validSize(data, maxSize)) { return new BaseState(false, AppInfo.MAX_SIZE); } String suffix = FileType.getSuffix("JPG"); String savePath = PathFormat.parse((String) conf.get("savePath"), (String) conf.get("filename")); savePath = savePath + suffix; String physicalPath = (String) conf.get("rootPath") + savePath; State storageState = StorageManager.saveBinaryFile(data, physicalPath); if (storageState.isSuccess()) { storageState.putInfo("url", PathFormat.format(savePath)); storageState.putInfo("type", suffix); storageState.putInfo("original", ""); } return storageState; }
public final State doExec() { String filedName = (String) this.conf.get("fieldName"); State state = null; if ("true".equals(this.conf.get("isBase64"))) { state = Base64Uploader.save(this.request.getParameter(filedName), this.conf); } else { state = BinaryUploader.save(this.request, this.conf); } return state; } }
public static State save(String content, Map<String, Object> conf) { byte[] data = decode(content); long maxSize = ((Long) conf.get("maxSize")).longValue(); if (!validSize(data, maxSize)) { return new BaseState(false, AppInfo.MAX_SIZE); } String suffix = FileType.getSuffix("JPG"); String savePath = PathFormat.parse((String) conf.get("savePath"), (String) conf.get("filename")); savePath = savePath + suffix; String physicalPath = (String) conf.get("rootPath") + savePath; State storageState = StorageManager.saveBinaryFile(data, physicalPath); if (storageState.isSuccess()) { storageState.putInfo("url", PathFormat.format(savePath)); storageState.putInfo("type", suffix); storageState.putInfo("original", ""); } return storageState; }
public final State doExec() { String filedName = (String) this.conf.get("fieldName"); State state = null; if ("true".equals(this.conf.get("isBase64"))) { state = Base64Uploader.save(this.request.getParameter(filedName), this.conf); } else { state = BinaryUploader.save(this.request, this.conf); } return state; } }
public static State save(String content, Map<String, Object> conf) { byte[] data = decode(content); long maxSize = ((Long) conf.get("maxSize")).longValue(); if (!validSize(data, maxSize)) { return new BaseState(false, AppInfo.MAX_SIZE); } String suffix = FileType.getSuffix("JPG"); String savePath = PathFormat.parse((String) conf.get("savePath"), (String) conf.get("filename")); savePath = savePath + suffix; String physicalPath = (String) conf.get("rootPath") + savePath; State storageState = StorageManager.saveBinaryFile(data, physicalPath); if (storageState.isSuccess()) { storageState.putInfo("url", PathFormat.format(savePath)); storageState.putInfo("type", suffix); storageState.putInfo("original", ""); } return storageState; }