Hi everyone,
The file plugin provided by default by elgg is useful when we I want to add a file in my social network. it is easy to create a ElggFile through it. I just have to upload the file using file browser.
Now I am working on a new plugin and I would like to create an ElggFile from existing file already store in my plugin directory.
For instance, in my plugin directory I have a sub-directory called /docs and it contains a file named "sample.doc".
So when a user click on "create new file" I would like to create and store ElggFile from "sample.doc".
Could someone help me ?
Regards,
info@elgg.org
Security issues should be reported to security@elgg.org!
©2014 the Elgg Foundation
Elgg is a registered trademark of Thematic Networks.
Cover image by RaĆ¼l Utrera is used under Creative Commons license.
Icons by Flaticon and FontAwesome.
- Nikolai Shcherbin@rivervanrain
Nikolai Shcherbin - 1 like
- Hermand Pessek@rheman
Hermand Pessek - 0 likes
- Hermand Pessek@rheman
Hermand Pessek - 0 likes
- Hermand Pessek@rheman
Hermand Pessek - 0 likes
- Jerome Bakker@jeabakker
Jerome Bakker - 1 like
- Hermand Pessek@rheman
Hermand Pessek - 0 likes
- Jerome Bakker@jeabakker
Jerome Bakker - 1 like
- Hermand Pessek@rheman
Hermand Pessek - 0 likes
You must log in to post replies.Are you saying that access to this sub-directory is available from the web?
If so, then you're in big trouble with the security of your site.
No... I am not saying that the sub-sirectory is accessible from the web.
Regards,
Is it possible to create ElggFile from existing one ?
Regards,
I am saying that when a user click on "create new" I want to create an ElggFile from "sample.doc" . The file "sample.doc" is stored in my plugin directory.
With the default ElggFile this isn't possible, you could make an extension of the ElggFile in your plugin and overrule the function getFilestore(); https://github.com/Elgg/Elgg/blob/01f00125e6b4fa068b38cda61980405360df539b/engine/classes/ElggFile.php#L347-L349
you can than make a different filestore which uses you plugin directory.
Thanks a lot @jerome Bakker.
I may not be explaining my issue well.
I want my users to create ElggFile just by clicking on a bouton not by uploading File. Hence, they do not have to upload a file. So when they click on "create" bouton, I want to create a ElggFile containg a sample document. The sample document is already stored in my plugin directory (sample.doc).
So each time a user will click on the create button, an ElggFile will be created containing the documents 'sample.doc'.
Please I need some guideline to achieve this.
Regards,
Ah OK, here we go ;)
In the action that follows the button click:
Thanks @jerome