Trigger auto download of image

Soldato
Joined
6 Mar 2008
Posts
10,085
Location
Stoke area
Hi all,

Just looking at a way of scanning an NFC tag, following a URL to an image and instead of loading in a web page, it auto downloads (or asks to download) the image.

Any suggestions of where to look?

Thanks
 
The webpage needs to return a 'content-disposition' header to the client to tell it that it's a file to download. In php it would be something like:

header("Content-Disposition: attachment; filename='image.png'");

You can set some other headers tell the client other things like what file type it is, etc. but that's the key one.
 
thanks, that led me to solve the issue. I had to add a couple of other header lines but runs a treat now and without the need for a button :)
 
Back
Top Bottom