---
title: "lista filer i dropmeny"
type: "forum-thread"
url: "https://www.webforum.nu/amne/asp/98243-lista-filer-i-dropmeny"
topic: "ASP"
topic_url: "https://www.webforum.nu/amne/asp"
author: "Belthor"
published: "2004-02-26T12:43:09.000Z"
updated: "2004-02-26T13:01:57.000Z"
replies: 2
views: 299
page: 1
pages: 1
language: "sv-SE"
site: "webForum — webforum.nu"
rights: "Upphovsrätten till varje inlägg tillhör dess författare."
attribution: "Citera som: webForum, https://www.webforum.nu/amne/asp/98243-lista-filer-i-dropmeny"
---

# lista filer i dropmeny

## #1 — Belthor, 2004-02-26T12:43Z

hej, jag har ett script som listar filer i en mapp på servern, nu skulle jag vilja ha det i en dropmeny, men vet inte riktigt hur jag ska skriva for satsen för att få varje fil på egen rad.

Här är scriptet som jag har för att lista filerna:

\<%
Function ShowFileList(strPath)
    Dim objFS, objFolder, objFile, strFiles
    Set objFS = CreateObject("Scripting.FileSystemObject")
    Set objFolder = objFS.GetFolder(strPath)
    strFiles=""
    For Each objFile in objFolder.Files
        strFiles = strFiles & objFile.Name & "\<br\>"
    Next
    Set objFolder=Nothing
    Set objFS=Nothing
    ShowFileList=strFiles
End Function

 
%\>\<select\>
\<option\>\<%=ShowFileList("c:\\download")%\>\</option\>
\</select

Permalänk: https://www.webforum.nu/p/98243

## #2 — @nders, 2004-02-26T12:50Z

Detta borde funka:

```
<%
Function ShowFileList(strPath)
Dim objFS, objFolder, objFile, strFiles
Set objFS = CreateObject("Scripting.FileSystemObject")
Set objFolder = objFS.GetFolder(strPath)
strFiles=""
For Each objFile in objFolder.Files
strFiles = strFiles & "<option>" & objFile.Name & "</option>"
Next
Set objFolder=Nothing
Set objFS=Nothing
ShowFileList=strFiles
End Function

%><select>
<%=ShowFileList("c:\download")%>
</select>
```

Och du, använd \[kod\]-taggar när du postar kod.

Mvh

Permalänk: https://www.webforum.nu/p/1286391

## #3 — Belthor, 2004-02-26T13:01Z

Tackar, det funkade utmärkt. (ska skriva i kod taggar nästa gång)

Permalänk: https://www.webforum.nu/p/1286396

---

Tråden på webben: https://www.webforum.nu/amne/asp/98243-lista-filer-i-dropmeny
