Results 1 to 2 of 2

Thread: Calling PHP script with file name

  1. #1
    Join Date
    Jul 2006
    Posts
    142
    Thanks
    7
    Thanked 0 Times in 0 Posts

    Default Calling PHP script with file name

    Here is what I am doing

    PHP Code:
    <?php
    $count 
    0;
    if (
    $handle opendir('.')) {
        while (
    false !== ($file readdir($handle))) {
            if (
    $file != "." && $file != "..") {$count++;
                print(
    "<a href=\"".$file."\">".$file."</a><br />\n");
            }
        }
    echo 
    '<br /><br /><a href="..">Return</a>';
        
    closedir($handle);
    }
    ?>
    I am listing all the files in a directory. For example: test.txt. What I want to accomplish is that whenever I click on the filename, I want to call a php script (or maybe in the same script) to perform some operation on the content of the test.txt file and give me the output for test.txt

    How can I do it?

    Please help!

  2. #2
    Join Date
    Jan 2008
    Posts
    4,168
    Thanks
    28
    Thanked 628 Times in 624 Posts
    Blog Entries
    1

    Default

    The script to get a file contents is:
    Code:
    file_get_contents('page here');
    If thats what you needed.
    Jeremy | jfein.net

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •