如何在单击';时设置文件/图像的名称;将图像另存为';


How to set the name of a file/image on clicking 'Save Image As'

我有一个页面,上面显示各种照片。每当用户点击"将图像另存为"时,我都想设置一个保存图片的名称,而不是用原始名称保存图片。如何做到这一点?

使用JavaScript无法做到这一点。

服务器需要发送包含正确文件名的Content-disposition标头。

if php:

header('Content-Disposition: attachment; filename='.$filename);