Jump to content

Archived

This topic is now archived and is closed to further replies.

riffkool

directory and file links

Recommended Posts

Hello,

I am stuck in trying to figure out how to set a schedule for files. I have this code (below) that i have put together to pull all the files in a particular folder on the webserver and list them on a page. I would like to have an "add" button (you can see what i started in the code) next to each item listed from the folder so that I can populate another page with a "schedule" or seperate list of all the files that the user clicks the add button. I have no idea how to accomplish this. Can someone please point me in the right direction? I hope I explained it well enough.


the include file:
[code]
<?php
     // Define the full path to your folder from root
    $path = ".";
    $fcount = 1;                        
     // Open the folder
    $dir_handle = @opendir($path) or die("Unable to open $path");
                            
    // Loop through the files
    echo "<table width=\"720\" align=\"center\"><tr><td width=\"240\" valign=\"top\">";
    while ($file = readdir($dir_handle))
    {  
        if($file == "." || $file == ".." || $file == "index.php" ||
        $file == "Thumbs.db" || $file == "list.php")
        continue;
        if ($fcount <=25)
        {echo "<a href=\"\"><img src = ../add.gif><a> ";
        echo "$fcount..";
        echo "<a href=\"$file\">$file</a>";
         echo "<br>";
         $fcount++;
         }        
        elseif ($fcount == 26)
        {echo "</td><td cellpadding=\"10\" width=\"240\" valign=\"top\">";
         echo "<a href=\"\"><img src = ../add.gif><a> ";
         echo "$fcount..";
         echo "<a href=\"$file\">$file</a>";
         echo "<br>";
         $fcount++;
        }
        elseif ($fcount <= 50)
        {echo "<a href=\"\"><img src = ../add.gif><a> ";
         echo "$fcount..";
         echo "<a href=\"$file\">$file</a>";
         echo "<br>";
         $fcount++;
        }
        elseif ($fcount == 51)
        {echo "</td><td cellpadding=\"10\" width=\"240\" valign=\"top\">";
         echo "<a href=\"\"><img src = ../add.gif><a> ";
         echo "$fcount..";
         echo "<a href=\"$file\">$file</a>";
         echo "<br>";
         $fcount++;
        }
        elseif ($fcount <= 75)
        {echo "<a href=\"\"><img src = ../add.gif><a> ";
         echo "$fcount..";
         echo "<a href=\"$file\">$file</a>";
         echo "<br>";
         $fcount++;
        }                      
      }


                            
?>
[/code]

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.