Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 7 of 7
  1. #1
    Regular Coder Bengal313's Avatar
    Join Date
    Jun 2002
    Location
    Metro Detroit
    Posts
    298
    Thanks
    8
    Thanked 0 Times in 0 Posts

    Importing data from folder step 1

    Okay, in my attempt to create this app, I have come across this problem, One of many.

    I have a folder on a server that contain images, .tifs. How can I import a list of the content into a drop down list in a php page?




    (Project over view)
    http://www.codingforums.com/showthre...threadid=29972
    "Knowledge Speaks But Wisdom Listens"

  • #2
    Regular Coder
    Join Date
    Sep 2002
    Location
    British Columbia
    Posts
    235
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Use these functions to read a directory's contents: http://ca3.php.net/manual/en/function.opendir.php

  • #3
    Regular Coder Bengal313's Avatar
    Join Date
    Jun 2002
    Location
    Metro Detroit
    Posts
    298
    Thanks
    8
    Thanked 0 Times in 0 Posts
    I added this piece of code and got this error. I image directory is testimges which is in the same directory as the php page.





    <?php
    $dir = "testimages";

    // Open a known directory, and proceed to read its contents
    if (is_dir($dir)) {
    if ($dh = opendir($dir)) {
    while (($file = readdir($dh)) !== false) {
    print "filename: $file : filetype: " . filetype($dir . $file) . "\n";
    }
    closedir($dh);
    }
    }
    ?>



    Warning: filetype(): Lstat failed for (null) (errno=2 - No such file or directory) in /usr/local/apache/htdocs/main/applications/imagefrontend/TMPkhtddpndhz.php on line 63
    "Knowledge Speaks But Wisdom Listens"

  • #4
    Regular Coder
    Join Date
    Sep 2002
    Location
    British Columbia
    Posts
    235
    Thanks
    0
    Thanked 0 Times in 0 Posts
    You will need a slash on the end of the dir, like in the example you copied from.

  • #5
    Regular Coder Bengal313's Avatar
    Join Date
    Jun 2002
    Location
    Metro Detroit
    Posts
    298
    Thanks
    8
    Thanked 0 Times in 0 Posts
    Okay I get it to work if the directory is a sub directory. What if the directory that I am trying to access is higher up? Say 4 folders up. One more thing is there any way to make the content of the folder appear in a drop down list? Thanx your help is greatly appriciated!
    "Knowledge Speaks But Wisdom Listens"

  • #6
    Regular Coder
    Join Date
    Sep 2002
    Location
    British Columbia
    Posts
    235
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Yes, all that can be done. It would be good for you to learn how to do these kind of things if you are going to program a website. There is lots of documentation to learn from online.

  • #7
    Regular Coder Bengal313's Avatar
    Join Date
    Jun 2002
    Location
    Metro Detroit
    Posts
    298
    Thanks
    8
    Thanked 0 Times in 0 Posts
    What sites do you recommend for a newbie, trying to learn php? I got the books and bookmarket php.net.
    "Knowledge Speaks But Wisdom Listens"


  •  

    Posting Permissions

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