Your Ad Here

Posted By

catchamonkey on 02/14/08


Tagged

php image html href linked


Versions (?)

Who likes this?

16 people have marked this snippet as a favorite

SpinZ
basicmagic
catchamonkey
jonhenshaw
n00ge
silverbux
Firemarble
wizard04
jamesming
irishsk
nb109
Hollow
silentbob84
bobbym245
hobbyman
wirenaught


Link to an image so it downloads rather than just displaying in the browser


 / Published in: PHP
 

  1. // The php (process.php)
  2.  
  3. $file = $_GET['file'];
  4. header ("Content-type: octet/stream");
  5. header ("Content-disposition: attachment; filename=".$file.";");
  6. header("Content-Length: ".filesize($file));
  7. readfile($file);
  8.  
  9. // In your html
  10. <a href="process.php?file=pic.jpg">Image goes Here</a>

Report this snippet  

Comments

RSS Icon Subscribe to comments
Posted By: PoNs on February 14, 2008

I haven't tested it but I bet it shows a error on the first run

Posted By: gd on February 20, 2008

It's a tipically sechole: http://victim.tld/process.php?file=/etc/passwd

You need to login to post a comment.