上传文件提交地址为
http://localhost:8888/rk_cms/admin/file/upload.rk
正文显示
{"type":"success","content":"成功"}
@At
@AdaptBy(type = UploadAdaptor.class, args = { "ioc:upload" })
@Ok("json")
public Message upload(@Param("fileType") FileInfo.FileType fileType, @Param("file") TempFile tempFile, HttpServletRequest req, AdaptorErrorContext errCtx) throws IOException {
if (Lang.isEmpty(tempFile)) {
if (Lang.isEmpty(errCtx)) {
return Message.warn("admin.error.message", req);
} else {
return Message.warn(errCtx.getAdaptorErr().getMessage(), req);
}
}
String path = req.getSession().getServletContext().getRealPath("");
fileService.upload(fileType, tempFile,path, true);
return Message.success("Message.Type.success", req);
}