file upload management in user profile field plugin

file upload management in user profile field plugin

by ariyan ariyan -
Number of replies: 1
Hi
I'm trying to create a file upload plugin for user profile field.
I'm saving the uploaded file by "file_save_draft_area_files" but when I check database's "files" table there is both saved and draft entries and the draft is not removed!
Also I can't findout how to get aved file data from "file_save_draft_area_files" to be able to serve it to user in "display_data"

My field.clas.php attached.

Can anyone help me with the Upload, Save & Serve process of a file in user profile field?

Thanks
Average of ratings: -
In reply to ariyan ariyan

Re: file upload management in user profile field plugin

by David Mudrák -
Mmàggini di Core developers Mmàggini di Documentation writers Mmàggini di Moodle HQ Mmàggini di Particularly helpful Moodlers Mmàggini di Peer reviewers Mmàggini di Plugin developers Mmàggini di Plugins guardians Mmàggini di Testers Mmàggini di Translators

Hi

draft is not removed

Correct. That's expected behaviour. IIRC, there is a garbage collector that cleans old draft areas later (sorry, away from my notebook now, can't check the code).

WRT the file serving, have you checked http://docs.moodle.org/dev/File_API ?