You could use CSS display:none; or in HTML: <style="display:none;"> tag if you simply want to hide the image. I expect you're using a submit button to remove the image?
<?php
if(isset($_POST['remove']))
{
?>
<div id="image" style="display:none;">
//image here
</div>
<?php
}
else
{
?>
<div id="image">
//image here
</div>
<?php
}
?>
Otherwise, If you want to remove the image completely from the upload directory, you could maybe try using unlink()? Note:- I've not used this function before. Alternatively, you can delete a whole directory if necessary, by using rmdir()
<?php
if(isset($_POST['remove']))
{
$File = "'memberFiles/'. $newname";
unlink($File);
}
?>
You may also want to delete the image path from the database if you're using one. Also make sure that users have the correct permissions to delete files from the server!
Just found this on the php man page:
"careful with unlink...
"very unlikely" is not "impossible" : granted, it will happen.
1) "expected" : a typo and you'll get : unlink('/')
2) "very likely" : some of your files are writeable by anyone.
3) "possible" : you're backup drive is mounted and preserves the authorizations of the original files
4) "very unlikely" : that particular day, at that particular moment, the unlink function decided to work recursively"