Adding a Video Album to Your ASP Website

Create a dynamic video gallery using Classic ASP and FlowPlayer

Posted by Hüseyin Sekmenoğlu on March 14, 2011 Tooling & Productivity

It all started with a simple idea. I just wanted to add a video album to our company's website. How hard could it be? I had heard of a free video player called FlowPlayer in the jQuery Tools collection. This seemed like the perfect time to try it out.

🗂️ Folder Setup and Video Preparation

First, I created a new folder in the project directory named VideoAlbum. I converted the videos I had into .flv format and placed them inside that folder.

The next step was to make those videos appear on the website. I found a sample script online that listed files from a folder. I made several changes to adapt it to my own needs.

Before getting into code, you will need:

  • A video editor that allows cutting, joining or trimming clips

  • A video converter that can export videos in .flv format

Once your videos are ready and inside the right folder, you can move on to coding.

💻 Classic ASP: Folder Scanning and Listing Videos

Here is the Classic ASP code I used to list the video files inside the folder:

<%
' First, create a FileSystemObject instance
Set fso = CreateObject("Scripting.FileSystemObject")

' Define the full path to the video folder
f2 = "D:\web\VideoAlbum"

' f represents the folder itself
' FileList is a collection of all files inside that folder
Set f = fso.GetFolder(f2)
Set FileList = f.files

' Loop through the list of files
For Each fn in FileList

    ' Check if the file extension is mpg or avi
    If LCase(Right(fn, 3)) = "mpg" Or LCase(Right(fn, 3)) = "avi" Then

        ' Strip the folder path and keep only the file name
        fsdir_temp = Right(fn, Len(fn) - Len(f) - 1)

        ' Write a clickable link to the video
        Response.Write("<a href=""?d=" & fsdir_temp & """>")
        Response.Write(Left(fsdir_temp, Len(fsdir_temp) - 4) & "</a><br>")

    End If
Next
%>

🧠 What This Code Does

  • It uses FileSystemObject to scan through the folder contents

  • Filters out files that are not .mpg or .avi

  • Extracts only the file names

  • Prints each file name as a clickable link on the page

This setup gave me a dynamic way to show videos on the site. Every time I added a new video file to the folder, it automatically appeared in the list without changing any code.

What happens when a video link is clicked? That part involves the d query parameter and embedding the video in a player, which is a bigger topic. I will explain that in the next article.