BBCode to download all attachments from current post

Started by WillLem, June 10, 2021, 02:46:38 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

WillLem

I'm wondering if there exists a way of creating a clickable link in a post containing a script/process which automatically scans the post for attachments, and downloads them if it finds them.

Reason:

I like being able to see how many people have downloaded a particular attachment, and I also like to keep everything together in one place as much as possible, so I'm put off the idea of providing fileshare links in posts.

However, I can also see the benefits of being able to place download links anywhere in a post.




EDIT: Apparently, according to phpbb.com, it is possible:


namida

QuoteEDIT: Apparently, according to phpbb.com, it is possible:

Irrelevant, as this site runs on SMF, not PHPBB. (The reasoning being simply "that's what the last iteration of the site ran on, and I stuck with what we were used to". You'd have to ask Adam, who's no longer around, why he chose SMF - and in fact, I have a vague recollection that the iteration before his was also SMF, so it might've been decided by that admin, with Adam just applying the same logic that I did.)

However, what you can do is:
1. Create a post, and for now put placeholders where you want these links to go. Attach the files.
2. Copy the attachment links to Notepad or a similar temporary place (make sure to make a note of which link is which!).
3. Edit your post, and replace the placeholders with these links. You can use the URL tag as normal, if desired.
4. If you replace the attachments later, make sure to update the links.

If you're going to try guessing what the next attachment ID will be rather than just posting first and copying the link, make sure you double-check that your guess was correct - you don't want to end up with a broken link because someone posted an attachment elsewhere at the same time and got the ID you were expecting!

The same requirements to download the attachment will apply as usual. If I remember, there are currently no restrictions on downloading attachments from posts (in particular, unlike most forums, login should not be required) but - while I have no plans or intentions at this time to change it, I make no promise that this will never change.

Note that you can also link to attachments on other posts this way. The download via your link (in either case - same post or different post) will still be counted in the attachment's download counter.

The one possible "gotcha" here - my gut assumption would be that you probably cannot attach an image to a post, then embed it in the same or another post with an IMG tag. This will likely only work for download links (including a link to an image file with the intent that the link downloads, not merely displays, the image).
My projects
2D Lemmings: NeoLemmix (engine) | Lemmings Plus Series (level packs) | Doomsday Lemmings (level pack)
3D Lemmings: Loap (engine) | L3DEdit (level / graphics editor) | L3DUtils (replay / etc utility) | Lemmings Plus 3D (level pack)
Non-Lemmings: Commander Keen: Galaxy Reimagined (a Commander Keen fangame)

WillLem

Click this link to download the text document titled 'Thanks namida!'