pussyback
Regular Member
- Apr 5, 2008
- 401
- 81
let say I have a jpg image on my server http://www.myserver.com/1.jpg when someone request it i want it auto start downloading a file like http://www.myserver.com/1.zip .
$fileurl='';//URL TO YOUR FILE
$size=strlen(file_get_contents($fileurl));
header('Content-type: application/force-download');
header('Content-Disposition: inline; filename="'.$fileurl.'"');
header('Content-Transfer-Encoding: Binary');
header('Content-length: '.$size);
header('Content-Disposition: attachment; filename="'.basename($fileurl).'"');
readfile($fileurl);
I know how to make it if someone clicks on the pic not when they view it.
you will need to rewrite 1.jpg to download.php using htaccess and in download.php have this code:
PHP:$fileurl='';//URL TO YOUR FILE $size=strlen(file_get_contents($fileurl)); header('Content-type: application/force-download'); header('Content-Disposition: inline; filename="'.$fileurl.'"'); header('Content-Transfer-Encoding: Binary'); header('Content-length: '.$size); header('Content-Disposition: attachment; filename="'.basename($fileurl).'"'); readfile($fileurl);
Options +FollowSymlinks
RewriteEngine on
RewriteRule ^1.jpg$ $download.php
You could do this with a simple javascript. Place the image of interest in a simple webpage. In the body tag of the page you'd just put onLoad="location.href=file2download.zip"
This way, as soon as the page loads, the download will start. No need to fool around with htaccess or php.
I see, well that's not working unfortunately, but good idea though - the problem is, it will download the ppi, BUT it will not install it - it will just download to their temporary files folder and sit there - so makes no sense, sorry. (however, you might stuff a cookie from your sig - anyway in both cases it will not display the picture at all)