Jump to content

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]
Link to comment
https://forums.phpfreaks.com/topic/10219-directory-and-file-links/
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.