Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Download file using select list

Explorer ,
Feb 09, 2009 Feb 09, 2009
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>
301
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Feb 09, 2009 Feb 09, 2009
What part is giving you difficulty, submitting the form to itself or downloading the file.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Feb 10, 2009 Feb 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
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Feb 10, 2009 Feb 10, 2009
LATEST
Looks like you are missing a cfoutput tag to read the variable in this tag.

<form action="docments/folder/#name#" method="post" class="styleform" >
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources