close ad
WARNING: Do Not Install the DREAMWEAVER CC 2017 or 2018 Update »
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Download file setup

Thread began 5/23/2014 8:22 am by s.joiner74419001 | Last modified 4/28/2015 2:53 pm by Ray Borduin | 1616 views | 19 replies |

s.joiner74419001

Download file setup

I have a 'Download file' behaviour applied to a form action page with a trigger of "before page load" so when the form is submitted it re-directs to the action page and downloads the PDF file. This works fine on desktop but on mobile devices it displays the download as the web page.

Is there a workaround for this?

I case there isn't I have tried to add a Submit button on its own on the page with the download behaviour applied to it but as explained in the Tutorial, you don't get an ID field to enter 'download' in it and there is no Submit/Button Download Pressed trigger option.

Does the button need to be in a form? All I want is a button the user clicks to download a PDF?

Sign in to reply to this post

Jason ByrnesWebAssist

The download may not work on mobile browsers. I know most mobile browsers don't properly implement file fields, so file upload does not work on mobile.

To use a button submit to submit a form, yes, the button will need to be in the form.

your form should also contain a hidden element that sets the download file name.

Sign in to reply to this post

s.joiner74419001

Problems again with file download

I am struggling to set up a download file form again and just can't seem to figure out where I am going wrong.

Here's the form.

<form method="post" enctype="multipart/form-data" name="download-file" id="download-file" action="" >

<input type="hidden" value="<?php echo $row_rsEnqDetails['files_c']; ?>">
<button type="submit" id="download" name="download" class="btn btn-default btn-xs">Download</button>
</form>

I have attached the full page if someone could help.

Thanks in advance!

Sign in to reply to this post

Ray BorduinWebAssist

Your hidden form element doesn't have a name... seems like you are trying to use it to pass the file name to be downloaded.

Also your download file name is set to: $_SESSION['members_id']

Seems like that would be set to the posted hidden form name since the file name isn't stored in that session variable.

I'd probably add: name="downloadFile"

to your hidden form element and then update the file name in the download server behavior to: <?php echo($_POST['downloadFile']); ?>

Sign in to reply to this post

s.joiner74419001

I'm totally confused now. I tried what you suggested but still know success. I think we need to go back to basics.

Files are uploaded by our members to a folder on our server where the membership number is passed to the file name. So for example Jo Bloggs with a memb' number 100001 uploads a file. This file is then named 100001.pdf. The folder it is placed in is admin/file-uploads/.

So I want to be able to download this file.

my download server behaviour is set to:

<?php
WA_DFP_SetupDownloadStatusStruct("WA_DownloadResult1");
if(isset($_POST["download"]) || isset($_POST["download_x"])){
WA_DFP_DownloadFile("WA_DownloadResult1", "../admin/file-uploads/", "100001_1.pdf", "[FileName]", false, false, false, "", "", "", "");
}
?>

My form is here:

<form method="post" enctype="multipart/form-data" name="download-file" id="download-file" action="" >

<input type="hidden" name="downloadFile" value="">
<button type="submit" id="download" name="download" class="btn btn-default btn-xs">Download</button>
</form>

I expect the hidden field needs a value but I am not sure what.

Attached is a screen shot of what I get when I click the button.

Where am I going wrong?

Sign in to reply to this post

s.joiner74419001

Hi Ray.

I've tried the same setup on a new page and it worked so there is something effecting it on the page.

Any ideas? .. page attached.

Cheers!

Sign in to reply to this post

s.joiner74419001

Question. Can you have an upload behaviour and a Download behaviour on the same page. Because I removed the upload behaviour from the page and then the download worked. Why is this?

Sign in to reply to this post

s.joiner74419001

All sorted now! not sure what the issue was but I re-worked the page and it now works.

Sign in to reply to this post

s.joiner74419001

So I have been working on another page that also has download behaviours which I have finished and is all working correctly. I then go back to the previous page I had problems with but eventually got working and the problem is back. I have not altered the page since so how can this happen?

Is there external PHP files that are possibly used by both pages that could be altered when editing one page which would effect the other?

Attached is the faulty page whith two download behaviours. both give the result similar to post #5 in the browser

Sign in to reply to this post

Ray BorduinWebAssist

There is a shared library file, but it wouldn't change from page to page, so one breaking the other doesn't make sense. I'd like to debug this with you directly. Please post a url to both pages and FTP access to the private area and I'll debug and let you know what is going on.

Sign in to reply to this post
loading

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...