I have a php script that renders an image (with imagick) and saves it to some directory "SITE_ROOT.$filePath"
, then does a header('Location: ' . SITE_ROOT.$filePath)
, the file it redirects to is a png image.
If I go to the path directly, like just type it in the URL bar I can save the image and everything works fine, however when I rely on the script to redirect me and I try to right click and save the image it doesn't recognise that I'm actually trying to save an image, it thinks I'm trying to save it as a non-typed file called 'Driver' which is the name of the script page.
I have no idea what's wrong here, surely the header location should just take me to the image and have no record of the 'Driver' file after it has redirected?
The same thing happens with redirect()
too btw.
Thanks in advance for any help!
Edit: This problem was solved by placing a die()
after the header command.