Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8488513
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T21:33:30+00:00 2026-06-10T21:33:30+00:00

I have very little background in website programming so I apologise if this might

  • 0

I have very little background in website programming so I apologise if this might be an obvious question.

I am updating some pages on a website using ASP. On a particular page, I have a list of pdf files that people can download. Currently, the title of the file is written in directly onto the page along with a link to it

myPage.asp    
<tr>
<td>Title</td>
<td><a href="something.pdf">PDF</a></td>
</tr>

I wanted to collect all the titles and filenames into one table, for example:

FileCode   Title    Filename
001        ABC      abcfile.pdf
002        XYZ      xyz.pdf

So that when I am populating the page I can use something like the following,

<tr>
<td>Table(code).Title</td>
<td><a href=Table(code).Filename>PDF</a></td>
</tr>

The code doesn’t have to look like that (I don’t know what it will look like); this is just an example to show what I mean: I want to be able to keep all the file information in one location so it is easy to update and add things to it, and I can just reference it when I need to display some information.

The reason I am doing this is because I don’t want the user to be able to directly click the pdf link and get the file; they must go through a contact form to get the file and I thought it might be easier to just send a file code instead of the actual filename,

<a href="contactForm.asp?code=001">PDF</a>

So this table will be accessed by contactForm.asp as well. Hence I wanted a central location for such a table and I didn’t know what are the acceptable conventions for websites.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T21:33:32+00:00Added an answer on June 10, 2026 at 9:33 pm

    The simplest solution would be to store the files in an array in an ASP include file, like this:

    files.asp

    <%
    Dim files(2, 2)
    files(0, 0) = "1"
    files(1, 0) = "File title 1"
    files(2, 0) = "file1.txt"
    files(0, 1) = "2"
    files(1, 1) = "File title 2"
    files(2, 1) = "file2.txt"
    files(0, 2) = "3"
    files(1, 2) = "File title 3"
    files(2, 2) = "file3.txt"
    %>
    

    (if the files are in a folder you would add the path, eg “/folder/file1.txt”)

    To display a list of files you could use this code:

    showfiles.asp

    <!--#include file="files.asp"-->
    <table>
    <tr>
    <td>FileCode</td>
    <td>Title</td>
    <td>Filename</td>
    </tr>
    <% Dim i : For i = 0 To UBound(files, 2) %>
    <tr>
    <td><%= files(0, i) %></td>
    <td><%= files(1, i) %></td>
    <td><%= files(2, i) %></td>
    </tr>
    <% Next %>
    </table>
    

    And to send the file to the browser you could use one of the following methods. The first one is just a simple redirect to the file, and the second actually loads the file and writes the file to the browser so that the user does not know the path to the file (more secure but not very secure):

    contact.asp

    <!--#include file="files.asp"-->
    <%
    Dim code, file, i
    code = Request.QueryString("code")
    For i = 0 To UBound(files, 2)
        If files(0, i) = code Then
            file = files(2, i)
            Exit For
        End If
    Next
    If file <> "" Then
        Response.Redirect(file)
    Else
        Response.Write("File not found")
    End If
    %>
    

    contact2.asp

    <!--#include file="files.asp"-->
    <%
    Dim code, file, i, stream
    code = Request.QueryString("code")
    For i = 0 To UBound(files, 2)
        If files(0, i) = code Then
            file = files(2, i)
            Exit For
        End If
    Next
    If file <> "" Then
        Set stream = Server.CreateObject("ADODB.Stream") 
        stream.Open 
        stream.Type = 1
        stream.LoadFromFile(Server.MapPath(file))
        Response.BinaryWrite(stream.Read) 
    Else
        Response.Write("File not found")
    End If
    %>
    

    Hopefully you can use some of this to make what you need?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a strong database background but very little practical experience with ms sql
I have very little experience with ASP.NET and I am doing some self-training before
I have very little experience working with sockets and multithreaded programming so to learn
I have very little experience using Sharepoint but a good amount using Visual Studio
I have very little programming knowledge; only a fair bit in Visual Basic. How
Warning: I have very little JavsScript experience. In my past programming experience, I usually
Our website code is written in PHP. We have very little testing in regards
I was wondering if somebody has some insight on this issue. A little background
Background Disclaimer: I have very little experience with Java. We previously used a wrapped
Background: I have extensive experience in web applications, but I have very little or

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.