$3 for quick help!

Namecheap AuctionsNamecheap Auctions
SpaceshipSpaceship
SpaceshipSpaceship
Watch

NetworkTown.Net

Account Closed
Impact
2
Hi

I need help right now, i have a directory full of images that have been uploaded by users, (this use's no mysql) so what i am making is a dmincp that will list all the images in view/ directory and then next to the image there is a button that will say delete so when i click on that button the image file is delted from view/ directory i have this so far.

PHP:
<?php

$read = '../view/';    
$myDirectory = opendir($read);    
   while($entryName = readdir($myDirectory))
   {
      if (strtolower(substr($entryName, -3)) == "jpg")
      {
         $dirArray[]=$entryName;
         echo $entryName.'<br />';

         echo '<TABLE width=500 align=center BGCOLOR=#CCCCCC>';
            echo '<TR><TD align=center valign=center>';
               echo '<img src=' .$read.$entryName. '> <a href="delete.php">Delete</a><BR>';
            echo '</TD></TR>';
         echo '</TABLE>';
       }
   }
   closedir($myDirectory);
?>

And i dont kow what to put in delete.php so please someone help me ill gve you $3 for this quick help..

Thanks
 
0
Close
The views expressed on this page by users and staff are their own, not those of NamePros.
GoDaddyGoDaddy
Modify this:

Code:
echo '<img src=' .$read.$entryName. '>
<a href="delete.php">Delete</a><BR>';
in:
Code:
echo '<img src=' .$read.$entryName. '>
<a href="delete.php?name=$entryName">Delete</a><BR>';

Put in delete.php:
Code:
<?php

$read = '../view/';  

if(!empty($_GET["name"]))
{
$file = $read . $_GET["name"];
if(unlink($file))
    echo "Done";
else
    echo "Error";

}

?>
 
0
Close
HI

I did that but when i go the link to delete the image the link looks like this:
Code:
http://localhost/imghost/admincp/delete.php?name=$entryName
 
0
Close
Sorry, try this one:
Code:
echo '<img src=' .$read.$entryName. '>
<a href="delete.php?name=' . $entryName . '">Delete</a><BR>';
 
0
Close
How do i make all images show? not only jpg?

PM me your paypal.
 
0
Close
Add at top of the filoe:
Code:
$type = array("gif", "jpg", "bmp");
(add in array all needed extensions).

Replace
Code:
if (strtolower(substr($entryName, -3)) == "jpg")
with:
Code:
if (in_array(strtolower(substr($entryName, -3)), $type) )
PM on the way :)
 
0
Close
Thanks, money sent.
 
0
Close
Good luck :)
 
0
Close
DomainEasy: flexible LTO options. Close more domain deals with financing.

We're social

Escrow.com
Spaceship
Domain Recover
CryptoExchange.com

NamePros updates

Switch between accounts
You can now stay logged in to more than one NamePros account in the same browser. Click your avatar, then "Accounts in this browser", to...
AIVikings
Catchy
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back