Please, someone make a "force download" stack (php script)

For my pdf, epub, and mobi download buttons I link to a “force download” php (readfile) script (hardcoded script, one for each file we deliver) which runs the file download. How nice it would be to have a stack to do this, complete with error checking and possibly even click counting (one count per ip address).

I know there are “bigger” “full blown” options… I’m asking for a simple button/script for this single application.

Maybe this new stack from Marathia? Check the last paragraph in the description.

https://rapidweavercommunity.com/addons/stacks/downloadlinkicon-stack

2 Likes

As David mentioned, this stack from Marathia comes very close to what you want:
http://rapidweaver.marathia.com/stacks/DownloadLinkIcon/

I have the stack and find it really useful and easy to use.

@el_mourabbi Do you have anything to add? Esp. regarding click counting?

1 Like

Why are epub and mobi files not shown any love? They’ve been around for years but you never see them included in tools such as this (icon, etc)

This stack is a possibility. I’ll probably obtain it and try it out. But again, I wish it had built-in “auto” icons for epub and mobi files.

Thanks for the tip Mathew and David! Appreciate your reading and responding to my request.

1 Like

Most newer web browsers support the HTML5 ‘download’ attribute, which will force a linked file to download:
https://www.w3schools.com/tags/att_a_download.asp
This can be added as a custom attribute, in the RapidWeaver link dialogue window.

I don’t understand “complete with error checking”. You can use existing tools like Integrity to scan a website for broken links or redirects and quickly fix them yourself:

As for counting (reliably) how often a link is clicked, most RW users already include Google Analytics so it would be easy to create a new campaign and get the full details of how often a link is clicked. You could measure both unique downloads and returning visitors. And get specific details like what times of day files get downloaded the most etc.

It is probably overkill for what you need, but the Paperless stack does most of what you want, and a whole lot more. Good if you have lots of downloadable files to list:
https://stacks4stacks.com/paperless/

3 Likes

HTML 5
Sadly, due to the nature of website/content, most of our visitors/business are users of old browsers.

ERROR CHECKING
I’m referring to error checking in the php script that downloads the file. My scripts to do the force download are 5 lines and there is no error checking. I basically set the read file name, out file name, and then do a php readme for the transfer. I do have to say though that we have hundreds of downloads a day on our free ebooks and I have virtually no support issues (file download errors.)
(I use Integrity by the way… but like I said… checking for broken links was not what i meant.)

ANALYTICS
I’ve used Google tracking for download clicks but I give up on them. I currently check my Clicky counts as Clicky tracks mobi and epub files automatically, unlike Google. But I find their counting to be suspect. I used to have hundreds of hand coded Google tracking links, complete with three "parameters’ (I forget what they are called) but then they just stop working one day with no explanation and I find out that Google has changed their tracking code requirements. I can’t go back and re-do hundreds of hand coded links.

PAPERLESS
I’ll absolutely check that out! I love your stacks and your business model and I know that I can always depend your stacks!

We sell lot’s of paid and free eBooks and with most being free, thus, development of the pages and downloads need to be fast and easy.

The perfect stack for me would consist of buttons/icons for pdf, mobi, and epub files with built in force downloads for all three. And built in ACCURATE click counting that requires no maintenance downstream.

Thanks Will. And thanks for your interest and help.

Will: That Paperless stack is fantastic! I don’t always need a table like it creates, but when I do … this is, by far, the easiest and best solution. Will be purchasing tomorrow. The demo really sold me on it.

1 Like

@willwood… We have some 8 and 10 part video set downloads and Paperless may just be perfect for setting up the download page for those sets. Just downloaded the demo…

1 Like

I designed the DownloadLink icon to primarily to add a file specific Font Awesome icon to download links, but the stack also has an option to ‘force a download’. This is achieved by adding the download tag as mentioned by @willwood. According to Can I Use, this will work for some 80% of your visitors (iOS and Internet Explorer are the main party poopers).

For those who want better coverage than that: in the stacks’s documentation is an overview of what I consider the most practical other options to force a download.

@Mathew: a click counter is something I have not planned for this stack, sorry.

I realize now that epub and mobi are not recognised by the stack now. Unfortunately Font Awesome still has no specific icons for that. @1611mac: Would the book icon be an alternative?

3 Likes

I think I’ll just stick to what I’ve do now, a linked image that runs my short php script for the force download and Clicky for the click counts.

As info, I also provide “optional” regular text links to the 3 files (pdf, epub, mobi) along with my buttons just in case of an issue with the php force download.

Thinking I can set it all up as a Stacks3 partial with the file names in the links being editable.

Thanks to all… discovered a couple of nice stacks from my question (for possible other applications)

thanks @el_mourabbi and @willwood and @Mathew for your interest and replies.

1 Like

This topic was automatically closed 6 days after the last reply. New replies are no longer allowed.