File API - get_file_content Moodle 2.6

File API - get_file_content Moodle 2.6

by Dave Emsley -
Number of replies: 1

I'm trying to develop my first block using the block development.  

So I have a block which opens a form for the user to upload a CSV file.  When I upload CSV file and click Save Changes I get the stdClass Object called $fromform.

$fromform-> is a filename of 11 numerals.

According to http://docs.moodle.org/dev/Using_the_File_API_in_Moodle_forms page the code $content = $mform->get_file_content('userfile');

will return the contents of the file.

 

I'm struggling to access $content as any form of data object.

Could anyone point me in the right direction please?  LMGTFY?  Knowing exactly what to look for would help wink

 

This is a very steep learning curve but I'm enjoying this and will be making the block available if I can get it to work as I think it could be of use to many sites.

Cheers

 

Dave

 

 

Average of ratings: -
In reply to Dave Emsley

Re: File API - get_file_content Moodle 2.6

by Dave Emsley -

Sorted.

I needed to replace the $mform with the name I was using.