Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

3.0.3 版本 文件上传一直不显示上传按钮 #407

Closed
Jzow opened this issue Jan 11, 2022 · 3 comments
Closed

3.0.3 版本 文件上传一直不显示上传按钮 #407

Jzow opened this issue Jan 11, 2022 · 3 comments

Comments

@Jzow
Copy link

Jzow commented Jan 11, 2022

参照官方文档很多次尝试,打开doc页面 接口没有 上传按钮的 选项

版本:
<knife4j-spring-boot-starter.version>3.0.3</knife4j-spring-boot-starter.version>

    @ApiOperation("文件上传")
    @PostMapping(value = "fileUpload")
    @ApiImplicitParams({@ApiImplicitParam(name = "file", value = "单个文件", required = true,dataType = "MultipartFile", allowMultiple = true),
            @ApiImplicitParam(name = "fileTypeEnum", value = "文件类型", required = true)}
    )
    public Result<FileUpLoadVO> fileUpload(@RequestParam(value="file") MultipartFile file, @RequestParam(value = "fileTypeEnum")FileTypeEnum fileTypeEnum) {
        FileUpLoadVO fileUpLoadVO = tencentService.fileUpload(file, fileTypeEnum);
        if(fileUpLoadVO == null){
            return Result.failed("文件上传失败,请检查命名格式!");
        }
        return Result.success(fileUpLoadVO);
    }
@ly1836
Copy link

ly1836 commented Jan 12, 2022

同问

@Jzow
Copy link
Author

Jzow commented Jan 12, 2022

@ly1836 你好,我已解决 file的@RequestParam 更换为 @RequestPart

    @ApiOperation("文件上传")
    @PostMapping(value = "fileUpload")
    public Result<FileUpLoadVO> fileUpload(@RequestPart(value= "file") MultipartFile file, @RequestParam(value = "fileTypeEnum")FileTypeEnum fileTypeEnum) {
        FileUpLoadVO fileUpLoadVO = tencentService.fileUpload(file, fileTypeEnum);
        if(fileUpLoadVO == null){
            return Result.failed("文件上传失败,请检查命名格式!");
        }
        return Result.success(fileUpLoadVO);
    }

@Jzow
Copy link
Author

Jzow commented Jan 12, 2022

@xiaoymin 建议补充官方doc 文档

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants