We Recommend

Wicked Cool PHP: Real-World Scripts That Solve Difficult Problems Wicked Cool PHP: Real-World Scripts That Solve Difficult Problems
Wicked Cool PHP contains a wide variety of scripts to process credit cards, check the validity of email addresses, template HTML, and serve dynamic images and text.


Posted By

fris on 02/13/08


Tagged

image file files filename


Versions (?)


Who likes this?

2 people have marked this snippet as a favorite

basicmagic
SpinZ


hide image path


Published in: PHP 


  1. <?
  2.  
  3. $query="SELECT filename FROM database where id=$file"
  4. $result=mysql_query($query) or die ("Error: ".mysql_error());
  5. $row=mysql_fetch_row($result);
  6.  
  7. header('Content-type: image/jpeg');
  8. readfile($row[0]);
  9.  
  10. ?>

Report this snippet 

You need to login to post a comment.