-1

A file named 'hashed.png' in server. and I can request like

"http://server_name/hashed.png"

but It's original name is 'hello.png' when I upload to server (It's relation is in db) and when I request that url and when download it, it named 'hashed.png'. I want to display it 'hello.png'

Summary : I want to do like this

  1. When I upload 'hello.png', server save it in 'hashed.png' + save in db relation of 'hello.png', 'hashed.png'. in php, I know 'hashed.png''s original name is 'hello.png'.

  2. When I request "server.com/hashed.png", image is display and when I try to save it, It's name is auto filled by 'hello.png'

I find named 'Content-Disposition' but, I don't know how to run php code when user request by image's direct url.

Soner Gönül
  • 97,193
  • 102
  • 206
  • 364

1 Answers1

0

If you are providing a download box that allows the user to save the image with the original file name, you can use:

http://php.net/manual/en/function.header.php#example-4903

If your goal is to display the image inline, using its original name, you may need to use rewrite rules that allow a request of the original file name but deliver the content from hashed.png.

user2182349
  • 9,569
  • 3
  • 29
  • 41