Skip to content

下载文件或下载压缩包时,如何通过修改content-disposition中 filename 值的方式自定义文件名? #54

@dengwenwen45

Description

@dengwenwen45

当前下载文件URL:http://localhost/dir/file.txt?download

使用以上URL下载文件时,默认文件名是 file.txt,因为服务端content-disposition = attachment; filename=file.txt; filename*=UTF-8''file.txt

如何通过修改URL链接参数的方式,修改服务端content-disposition中的filename值呢?
比如加入参数filename:http://localhost/dir/file.txt?download&filename=new_file_name.txt
让服务端content-disposition 值变成 attachment; filename=new_file_name.txt; filename*=UTF-8''new_file_name.txt

同理下载压缩包 http://localhost/tmp?zip&filename=new_file_name.zip
让服务端content-disposition 值变成 attachment; filename=new_file_name.zip; filename*=UTF-8''new_file_name.zip

可以实现么?

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions