i'm new to elgg and php,please help me.
i need a help to make a plugin. I want to upload a file to data folder. And iframe the file in view of that object along with title and description. Pls reply with some sample codes.
Can anyone tell how to save a file and get the link to file.
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.
Have a look at the files plugin > actions> upload.php file. it will teach you how to save a file in data directory.
To get the file URL $entity->getURL(); But this will only give you the read view of the entity. If you want to output it as iframe the URL needs http://site.com/mod/file/download.php?file_guid=GUID
i make a plugin by refering file plugin as you said. Now i'm able to upload file to data folder. Can you tell how to get the file. I can't understand it from file plugin. Pls help.
pls help me to read a file from data folder with my own plugin.
The above code is used by the file plugin to display the file in a view. It does that by trying to find a specific view for the file type and if finding it will display it.
You need to determine the following two things before that code:
The $vars['entity'] needs to be the file you're are trying to show.
The $mime can be gotten by doing : $mime = $vars['entity']->getMimeType;
when I use the same codes in mod/file/pages/file/download.php to download a file in my own plugin it shows a blank page. Did I forget any thing. Can any one tell codes in a download page to get the file. There is no other problem.
Using elgg 1.8.2
a complete blank page or just where you want the file to appear is blank?
i just give a download button as in file plugin in object view page. When i click on the download page it goes to a blank page.
blank page is some thing like www.mysite.com/pluginname/download/(guid)
i register the action and page handler for download as in file plugin. The upload is working fine when i check the datafolder the file there.
one thing i found that when i use the guid of uploaded file using file plugin in above address i get the file. When i use the guid of file that uploaded by my plugin i get blank page.
Turn on error display and post back with the error you're getting: http://docs.elgg.org/wiki/White_page#display_errors
only white page even after turning display error on.
Share the code of download action
- Previous
- 1
- 2
- Next
You must log in to post replies.