Downloading a file with a different name to the stored name

前端 未结 5 835
灰色年华
灰色年华 2020-11-30 08:37

Is it possible to let your user download a file with a different name?

For example, there is a file called \"4324ffsd34.jpg\". I want people to download it via down

5条回答
  •  渐次进展
    2020-11-30 09:03

    Sure, use a Content-disposition header

    header('Content-Disposition: attachment; filename="filetodownload.jpg"');
    

    if you wish to provide a default filename, but not automatic download, this seems to work.

    header('Content-Disposition: filename="filetodownload.jpg"');
    

提交回复
热议问题