[advanced search]
 

Go Back   NamePros.com > Discussion > Web Design & Development > Programming

Programming PHP, Perl, Ruby on Rails, AJAX, HTML, XHTML, CSS, JavaScript, MySQL and any other coding topics.


Closed Thread
 
LinkBack Thread Tools
Old 08-29-2006, 04:32 AM   #1 (permalink)
Account Closed
 
Join Date: Oct 2005
Location: United Kingdom
Posts: 1,554
55.39 NP$ (Donate)

NetworkTown.Net is just really niceNetworkTown.Net is just really niceNetworkTown.Net is just really niceNetworkTown.Net is just really nice


$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..

Thanks
NetworkTown.Net is offline  
Old 08-29-2006, 04:48 AM   #2 (permalink)
Senior Member
 
Constantin's Avatar
 
Join Date: Jan 2006
Posts: 1,081
269.00 NP$ (Donate)

Constantin is a splendid one to beholdConstantin is a splendid one to beholdConstantin is a splendid one to beholdConstantin is a splendid one to beholdConstantin is a splendid one to beholdConstantin is a splendid one to beholdConstantin is a splendid one to behold


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";

}

?>
Constantin is offline  
Old 08-29-2006, 04:55 AM   #3 (permalink)
Account Closed
 
Join Date: Oct 2005
Location: United Kingdom
Posts: 1,554
55.39 NP$ (Donate)

NetworkTown.Net is just really niceNetworkTown.Net is just really niceNetworkTown.Net is just really niceNetworkTown.Net is just really nice


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
NetworkTown.Net is offline  
Old 08-29-2006, 05:02 AM   #4 (permalink)
Senior Member
 
Constantin's Avatar
 
Join Date: Jan 2006
Posts: 1,081
269.00 NP$ (Donate)

Constantin is a splendid one to beholdConstantin is a splendid one to beholdConstantin is a splendid one to beholdConstantin is a splendid one to beholdConstantin is a splendid one to beholdConstantin is a splendid one to beholdConstantin is a splendid one to behold


Sorry, try this one:
Code:
echo '<img src=' .$read.$entryName. '>
<a href="delete.php?name=' . $entryName . '">Delete</a><BR>';
Constantin is offline  
Old 08-29-2006, 05:07 AM   #5 (permalink)
Account Closed
 
Join Date: Oct 2005
Location: United Kingdom
Posts: 1,554
55.39 NP$ (Donate)

NetworkTown.Net is just really niceNetworkTown.Net is just really niceNetworkTown.Net is just really niceNetworkTown.Net is just really nice


How do i make all images show? not only jpg?

PM me your paypal.
NetworkTown.Net is offline  
Old 08-29-2006, 05:37 AM   #6 (permalink)
Senior Member
 
Constantin's Avatar
 
Join Date: Jan 2006
Posts: 1,081
269.00 NP$ (Donate)

Constantin is a splendid one to beholdConstantin is a splendid one to beholdConstantin is a splendid one to beholdConstantin is a splendid one to beholdConstantin is a splendid one to beholdConstantin is a splendid one to beholdConstantin is a splendid one to behold


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
Constantin is offline  
Old 08-29-2006, 06:36 AM   #7 (permalink)
Account Closed
 
Join Date: Oct 2005
Location: United Kingdom
Posts: 1,554
55.39 NP$ (Donate)

NetworkTown.Net is just really niceNetworkTown.Net is just really niceNetworkTown.Net is just really niceNetworkTown.Net is just really nice


Thanks, money sent.
NetworkTown.Net is offline  
Old 08-29-2006, 09:14 AM   #8 (permalink)
Senior Member
 
Constantin's Avatar
 
Join Date: Jan 2006
Posts: 1,081
269.00 NP$ (Donate)

Constantin is a splendid one to beholdConstantin is a splendid one to beholdConstantin is a splendid one to beholdConstantin is a splendid one to beholdConstantin is a splendid one to beholdConstantin is a splendid one to beholdConstantin is a splendid one to behold


Good luck
Constantin is offline  
Closed Thread


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

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Site Sponsors
Advertise your business at NamePros

All times are GMT -7. The time now is 04:35 AM.


Powered by: vBulletin® Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0
Template-Modifications by TMS
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85