|
Posted by -K. on 10/13/78 11:13
--- Mario de Frutos Dieguez <marfru@cartif.es> wrote:
> I have a page where i place an image but i want when
> i show the image delete it. How can i do this?
Some good suggestions so far but to be a little more
explicit this is how you would do it. Essentially you
want to have your image tag point to a script, have
that script pass the image to the browser then delete
the image.
Please note, this example code, for simplicity sake,
leaves out any security precautions.
On you main page you'll have an image tag like:
<img src="show_image.php?image_name=some_image.jpg">
Then show_image.php will look something like this:
<?Php
$filepath = $_GET['image_name'];
$fd = fopen($filepath,'r');
fpassthru($fd);
fclose($fd);
unlink($filepath);
?>
Remember though, as written you need to do some
validation on $filepath, because as is, this script
will pass anything to the user that is contained in
$_GET['image_name'] then delete it, so be careful.
-k.
__________________________________
Do you Yahoo!?
Yahoo! Small Business - Try our new resources site!
http://smallbusiness.yahoo.com/resources/
Navigation:
[Reply to this message]
|