Hello everyone!
So, I'm trying to develop an elgg mod.
I want to upload different types of files to different places or just tag/identify this files so I can display them in different pages, like one page for images, other for videos and another for musics. The pages (music, videos and images) are already created (blank), but I don't know how to separate/tag nor how to get them separately.
If anybody could help me I would be very thankful
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.
- Guilherme Two.@guitwo

Guilherme Two. - 0 likes
- Matt Beckett@Beck24

Matt Beckett - 0 likes
- rjcalifornia@rjcalifornia

rjcalifornia - 0 likes
- DhrupDeScoop@Dhrup2000

DhrupDeScoop - 0 likes
- Guilherme Two.@guitwo

Guilherme Two. - 0 likes
- DhrupDeScoop@Dhrup2000

DhrupDeScoop - 0 likes
- itstheshawnp@itstheshawnp

itstheshawnp - 0 likes
- Trajan@Trajan

Trajan - 0 likes
- itstheshawnp@itstheshawnp

itstheshawnp - 0 likes
- Trajan@Trajan

Trajan - 0 likes
You must log in to post replies.if the question was "how can i change my profile picture", it would have +50 answers...
No need to upload to different places, depending on what you want to do or how you want to organize them you can set a piece of metadata on them at the time of uploading. Whether this is user-supplied (as in tags) or programmatically (by mime-type maybe?) it's all done the same way. You can then list them by searching by metadata.
Hi!
Ok, a way to do it would be to add a field 'file type' so that users can select what it is, and save that field as a tag, then just sort the files by tags.
This way would be easier to do for your users, because not everybody will remember to add the tag of the file type, instead do a mandatory field.
Also, you can do what Matt Beckett says. You should be able to query the files based on the simpletype metadata field to determine which kind of file should go where.
Hope that helps.
Rodolfo Hernandez
Arvixe/Elgg Community Liaison
not exactly ;-) mimetype *is already metadata - as matt kinda said -- so the '..searching (entities) by metadata' approach will work q. oki-doki... whether on mimetype or simpletype - there's a choice. ps: only 47 more answers left to go ;-)
yeah, I'll try to use the mimetype data.
thank you so much bros!
$mime = $file->mimetype;Look for code that looks like :-
$... = $file->mimetype;
in the Files PlugIn --
That is what grabs at the stored mime type for files.
i have been using the tags to seperate my files, but i do understand what he wants as i want the same thing. for example when you join a group it has a section called files where you can upload any file be it a doc, photo, video, or audio file...and they all show up on the list. it would be nicer to see a section for files, section for photos, section for video, and a section for audio, all with seperate mime type restrictions so users dont upload to the wrong sections. sure searching using meta data and tags works, but simply for the sake of looks and asthetics, keeping them seperate just looks better!
@itstheshawnp - no need to have physical sections. What you're talking about is quite simple to do I believe.
1) get all files in the group (get by container_guid)
2) sort them into individual arrays by mimetype (foreach $files as $file etc.)
3) create dynamic tabs for each array if it's not empty
Ok, there's a bit more too it than that, with a couple of checks etc. but it's not too difficult. No need to worry about different upload forms or setting more metadata.
P.S. For those who ask about "What happens when the mimetype doesn't get saved properly?", my solution would be to have an array of accepted mimetypes to create these individual arrays from. Any types that aren't listed in said array go into a special 'Misc' array. That way you don't lose files if the system hiccups while uploading.
how would i go about doing that? would you have an example code to test? especially since i have been looking into editing the tabs at the top of the site.
I don't work with 1.8 so I've not got any code example. On further thought you might wanna think about organizing by simpletype instead of mimetype, because you'll have less tabs to deal with.