Reply to Re: [PHP] Image and PHP

Your name:

Reply:


Posted by -K. on 10/24/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/

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация