Hi folks,
started to work with elgg currently and trying to make a plugin that handles it's own "types" (elggObject + metadata). I managed to add all the fields I needed, but I can't make elgg upload iamges/icons/w.e. thei're called.
$form = elgg_view("input/file", array("name" => "icon"));
echo elgg_view('input/form', array(
'action' => 'action/text_type/save',
'enctype' => 'multipart/form-data',
'body' => $form));
Is working, except in HTML the enctype is missing and (I believe) therefore uploading images isn't working ($_FILES on action page and get_uploaded_file('icon') both empty). What am I doing wrong?
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.
- ihayredinov@ihayredinov

ihayredinov - 0 likes
- hunteeer@hunteeer

hunteeer - 0 likes
- ihayredinov@ihayredinov

ihayredinov - 0 likes
- hunteeer@hunteeer

hunteeer - 0 likes
- ihayredinov@ihayredinov

ihayredinov - 0 likes
- http://learn.elgg.org/en/stable/guides/hooks-list.html
-
- entity:icon:file, <entity_type>
- Triggered by
You must log in to post replies.That should be working. Try using elgg_view_form(), and if it works, report the issue on github.
Thanks. While applying your suggestion I found the error I made, but I have a problem getting/displaying these images now:
to save the image and this in view to display it:
results in this error (loosely translated from german to english):
(obviously the path is wrong with "icons/" in it, but changing the save function to prefix with "icons" instead of "test" results in same error.
http://learn.elgg.org/en/stable/guides/database.html?highlight=icons#entity-icons
All the methods starting with set (e.g. setIconFromElggFile() ) are undefined.
Got it to work somehow with:
But I want to store the images in their own directory instead of .../icons/...
ElggEntity::getIcon()and allows plugins to provide an alternativeElggIconobject that points to a custom location of the icon on filestore. The handler must return an instance ofElggIconor an exception will be thrown.