Today's Posts Follow Us On Twitter! TFL Members on Twitter  
Forum search: Advanced Search  
Navigation
Marketplace
  Members Login:
Lost password?
  Forum Statistics:
Forum Members: 24,254
Total Threads: 80,792
Total Posts: 566,471
There are 1022 users currently browsing (tf).
 
  Our Partners:
 
  TalkFreelance     Design and Development     Programming     PHP and MySQL :

$3 for quick help!

Thread title: $3 for quick help!
Closed Thread    
    Thread tools Search this thread Display Modes  
08-29-2006, 11:36 AM
#1
NetworkTown.Net is offline NetworkTown.Net
Status: Member
Join date: Aug 2005
Location:
Expertise:
Software:
 
Posts: 313
iTrader: 0 / 0%
 

NetworkTown.Net is on a distinguished road

  Old  $3 for quick help!

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 Code:
<?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..

08-29-2006, 01:56 PM
#2
Austin is offline Austin
Status: Member
Join date: Apr 2006
Location:
Expertise:
Software:
 
Posts: 353
iTrader: 5 / 100%
 

Austin is on a distinguished road

Send a message via Skype™ to Austin

  Old

Ok I have a super basic way of doing it. It probably need some error checks and what not but oh well.

I changed up your original script a bit by adding some @ to make it work.

PHP Code:
<?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?a=' .$entryName'">Delete</a><BR>';
            echo 
'</TD></TR>';
         echo 
'</TABLE>';
       }
   }
   @
closedir($myDirectory);
?>
This is delete.php; It is super simple but it works.
PHP Code:
<?php

    $image 
$_GET['a'];
    
$path "./view/";
    
$imgToDel $path.$image;
    @
unlink($imgToDel);
    echo 
"Image deleted! <a href=''>Go Back</a>";

?>
If you need to know how it works or anymore questions lemme know!

Closed Thread    


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 

  Posting Rules  
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump:
 
  Contains New Posts Forum Contains New Posts   Contains No New Posts Forum Contains No New Posts   A Closed Forum Forum is Closed