wget --no-check-certificate https://github.com/sjqzhang/go-fastdfs/releases/download/v1.3.1/fileserver -O fileserver && chmod +x fileserver && ./fileserver
@ApiOperation("文件上传")
@Mapping("/upload")
public String upload(UploadedFile file){
String result = "";
InputStreamResource isr = new InputStreamResource(file.getContent(),
file.getName());
Map<String, Object> params = new HashMap<>();
params.put("file", isr);
params.put("path", "86501729");
params.put("output", "json");
String resp = HttpUtil.post("http://192.168.1.156:8080/upload", params);
Console.log("resp: {}", resp);
result = resp;
return resp;
}
@ApiOperation("下载")
@Mapping("download")
public void down(Context ctx) throws IOException {
File file = new File("http://192.168.1.156:8080/group1/zkcy/screenshot-20230217-112719.png");
ctx.outputAsFile(file);
}
web页面安装
命令介绍
1.运行
./goFastDfsWeb.sh start
2.查看运行状态
./goFastDfsWeb.sh status
3.重新启动
./goFastDfsWeb.sh restart
4.停止
./goFastDfsWeb.sh stop
如遇到-bash: ./goFastDfsWeb.sh: /bin/bash^M: 坏的解释器: 没有那个文件或目录错误,则执行以下命令再运行
sed -i 's/\r//' ./goFastDfsWeb.sh
web界面配置
1. cfg.json 在安装路径下的conf文件夹下


开启上传验证
在cfg.json中添加 验证url 
代码示例
@ApiOperation("文件上传")
@Mapping("/upload")
public String upload(UploadedFile file,String authToken){
InputStreamResource isr = new InputStreamResource(file.getContent(),
file.getName());
Map<String, Object> params = new HashMap<>();
params.put("file", isr);
params.put("path", "zkcy");
params.put("output", "json");
params.put("auth_token", authToken);
String resp = HttpUtil.post("http://192.168.1.156:8080/upload", params);
Console.log("resp: {}", resp);
return resp;
}
//cfg.json中配置的验证url 校验token
@Post
@ApiOperation("验证")
@Mapping("/auth")
public String auth(String auth_token) throws Exception {
if ("ok".equals(auth_token)){
return "ok";
}else {
return "fail";
}
}