Skip to main content
Inspiring
February 9, 2009
Question

Download file using select list

  • February 9, 2009
  • 2 replies
  • 343 views
Can anyone please tell me how I can download a file, by submitting a form to itself?

I have this code so far but it doesnt work:

<cfset thePath = "c:\inetpub\wwwroot\documents\folder">
<cfdirectory name="docs" action="List" directory="#thePath#" sort="Name ASC">
<form action="docments/folder/#name#" method="post" class="styleform" >
<select name="file" id="file" class="standard" >
<option value="">Choose a file</option>
<option value="">-----------</option>
<cfoutput query="docs">
<option value="#name#">#name#</option>
</cfoutput>
</select>

<input name="submit" type="submit" value="submit" />
</form>
    This topic has been closed for replies.

    2 replies

    Inspiring
    February 10, 2009
    Looks like you are missing a cfoutput tag to read the variable in this tag.

    <form action="docments/folder/#name#" method="post" class="styleform" >
    Inspiring
    February 9, 2009
    What part is giving you difficulty, submitting the form to itself or downloading the file.
    matthiscoAuthor
    Inspiring
    February 10, 2009
    Hi Dan,

    Submitting the form seems to be the problem, Is there a better way to do this?

    I just get xxx/xxx/#name# in the address bar when I submit the page.

    I have all my documents stored in the same folder, I'd like to use cfdirecotry to get the files and download them by selecting them from a drop down list.

    Thanks again