close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Download file

Thread began 1/11/2012 2:06 pm by newimage96814918 | Last modified 1/12/2012 5:32 pm by newimage96814918 | 1667 views | 7 replies |

newimage96814918

Download file

Probably in the wrong forum here, but I'm trying to use the download file behavior.
I have a data base that has file names-title of the file and the actual file somthing.pdf in the uploads folder. I tried applying download file but I guess I don't understand the triggers here like form submit and such, I want to force download when click on link to the dynamic pdf file from database rather than opening or saying "right click and save as" I want to force download. is this extention able to do that or do I need a bit of custom code?

Sign in to reply to this post

Jason ByrnesWebAssist

create a record set to return the file name.

add a table to the page with 1 row and 2 columns.

in the column on the left, use the bindings panel and drag the binding for the file s title.

in the column on the right, add a form, a hidden form element and a submit button. for the hidden form element, set the initial value to use the file name column from the recordset.

now, in the tag selector at the bottom of the screen, select the TR tag for the table row. go to the server behaviors panel, click the plus button and select repeat region, select your recordset and set it to display all rows..

at run time, this will create a row in the table for each file in the database with a download button for each one.

now add the download file behavior. Use the Submit button pressed trigger.

for the file name, click the lightning bolt and select the hidden form element.

for the file folder, select the folder the files are stored in.

the forms submit button will now trigger the download behavior, and the download behavior will the name of the file to download from the hidden element.

Sign in to reply to this post

newimage96814918

Could this be worked from my link to auto download from click or set the submit buton to a link.
Or is it better to do it this way which will for sure work I would rather they just click the link and download or supply a "download" link instead of a button as would fit in my layout best

Sign in to reply to this post

Jason ByrnesWebAssist

go to the bindings panel and click the plus button, select URL variable and set the name to "file"

create the link as:
<a hef="downloadpage.php?file=<?php echo $row_recordsetname['filenameColumn']; ?>">Download</a>

where downloadpage.php is the name of the page with the download behavior and behavior on it, recordsetname is the name of the recordset and filenameColumn is the name of the file name column in the database.

in the download behavior, clickthe lightning bolt icon next to trigger and filename and select the file querystring binding.

Sign in to reply to this post

newimage96814918

Thanks, perfect as always!

Sign in to reply to this post

newimage96814918

Sorry one more quick question, This is in a footer that will be on every page this is the link now:
<a href="uploads/<?php echo $row_rsforms['form_file']; ?>"><?php echo $row_rsforms['form_name']; ?></a>

Is there a way to have it just refresh to it self to pass the param when clicked without specifiying a page per say..

Sign in to reply to this post

Jason ByrnesWebAssist

not really, that would mean having to add the download behavior to every page as well as the footer.

Sign in to reply to this post

newimage96814918

Alright, I might just try your solution, with the form and buttons in the repeat region.
Thanks for all your help!

Sign in to reply to this post

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...