Skip to main content
Topic: How do I add attachments from a directory? (Read 1945 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

How do I add attachments from a directory?

As I archive sometimes large files and the forum is on a shared hosting plan their upload file limit prevents me from uploading through ElkArte some files. I can upload the files through ftp but have not seen a way to add attachments from a directory. Of course, I can add them directly to the attachments dir but doubt it will be seen in the database? Any help or ideas?

Thanks for your time.
Last Edit: May 18, 2016, 02:41:32 pm by jakedp

Re: How do I add attachments from a directory?

Reply #1

I don't think it's possible at all, for security purposes.
~ SimplePortal Support Team ~

Re: How do I add attachments from a directory?

Reply #2

Hi jakedp and welcome to elkarte.net. :)

Quote from: jakedp – I can add them directly to the attachments dir but doubt it will be seen in the database?
Yep, the directory is just where the files are stored, not the place that instructs elkarte that a certain file is an attachment, that place is the database.

The idea is interesting (and there is no more security issues than uploading the file from the post form, actually there could be less because it would be a fully "admin-driven" operation), though it would present a small problem: elkarte only knows files attached to a certain message, as such any time you'd upload a file through ftp, there should be a way to "bind" each file to a certain message of a topic. That has some implications on the usability of such a function, for example, in order to keep it simple, I'd limit to one message for each bunch of files uploaded (i.e. elk scans the directory with the files to attach and it would ask you which is the message to attach them), of course there would be to decide what to do with all the constrains (number of attachments per message, maximum size per attach and max sum sizes, allowed extensions, etc.), if enforce them, or let them slide on the basis that an admin is doing the operation and as such he should be allowed to do something more.
And probably there could be some more edge cases.
Bugs creator.
Features destroyer.
Template killer.

Re: How do I add attachments from a directory?

Reply #3

As far as I remember the attachments get their names hashed, so not sure how you'd do that, if you bypass the name hash then you got a problem. Perhaps you got another idea. Probably.
~ SimplePortal Support Team ~