Associate hyperlink to Folder RRS feed

  • Question

  • I want to create a hyperlink to a folder and view its contents (photos) on my website.  How do I associate a folder in the "Folder List" in EW3 to a hyperlink so I can view the contents?  Every time I do this, I only can see the directory not the photos.  I published the folder and contents to my site.  Maybe I don't have it setup correctly.  Fairly new to EW.  Please help.

    website location for the hyperlink:  http://njkofcmm.com/photos.html


    Monday, May 21, 2012 9:26 PM

All replies

  • I can see the photos on the page "photos.html"  (albeit a little slow, as this page looks like it was created in MS Publisher, not EW) for the web address you gave above, http://njkofcmm.com/photos.html, however are you asking how to just display a folder containing the images?  This is not  strictly an Expression Web issue.  

    You can create the link that points to a folder (and not a specific file) and it should list the files in that folder, however in your case the folder containing the photos (which appears to be http://njkofcmm.com/Photos/ ) does not allow directory browsing and gives this error:

    Directory has no index file.

    Browsing this site or directory without an index file is prohibited.

    If you are the site's webmaster, you can remedy this problem by creating a default HTML page with one of the following names:

    • index.html
    • index.htm
    • default.htm
    • Default.htm
    • home.html
    • Home.chtml

    NOTE: Filenames are case sensitive, i.e., Home.html is not the same as home.html

    To fix this you need to contact your host and ask them to turn on 'directory browsing' or you can turn this option on in the Control Panel facility for your hosting service (e.g. cPanel or Plesk etc).  However this may not be an option you can change in some instances.

    Andrew M


    "Nothing spoils numbers faster than arithmetic!"
    -- Peppermint Patty (Peanuts, Charles M. Schulz)

    • Edited by AndrewOZ1 Monday, May 21, 2012 10:09 PM
    Monday, May 21, 2012 9:49 PM
  • You don't link to a folder and expect images to display in a page.

    A link to a folder will get you either an html page (if there is one inside the folder with the correct name for a default page on your host) or a listing of the files and folders inside it (if your site security allows this - not good practice).

    To display images on the web, you must put them on a page, as you have done on http://njkofcmm.com/photos.html, or, to let the browser open just one picture, link directly to the image file.

    If you want to list the file in a folder and dynamically put those file names in <img> tags on a page, you need a scripting solution.  It's not something done autmoatically.  Google and yea shall find.  Or tell us what scripting language your hosting account supports, and you may get some recommendations.

    • Edited by KathyW2 Monday, May 21, 2012 9:52 PM
    Monday, May 21, 2012 9:51 PM
  • Adding a simple (no page formatting) example, if you can use PHP, modify the example at : http://www.brightcherry.co.uk/scribbles/php-list-all-files-in-a-directory/

    Create a page with .php extension, containing:

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
    $directory = "images/"; //the directory for the images, relative to this page
    //get all image files with a .jpg extension.
    $images = glob($directory . "*.jpg");
    //echo each file name to the page, concatenated between the HTML markup for an image
    foreach($images as $image)
    echo '<img src="'.$image.'"/>';

    • Edited by KathyW2 Monday, May 21, 2012 10:09 PM
    Monday, May 21, 2012 10:07 PM