The files table stores files in a big list, with several fields that sort the files into areas. Specifically, each file has a context, component, filearea and itemid.
You tell the file upload widget what these parameters are and it sets them when it saves files. When you retrieve files, you supply the same parameters and it will return an array of all the files that were saved with those details.
Saving files:
// Add this to the definition() method in a moodleform
$filemanager_options = array('subdirs'=>1, 'maxbytes'=>$this->_customdata['course']->maxbytes, 'maxfiles'=>10, 'accepted_types'=>'*', 'return_types'=>FILE_INTERNAL);
$mform->addElement('filemanager', 'submission', get_string('uploadafile'), null, $filemanager_options);
// Then, when you save the form's data:
file_save_draft_area_files($submission->submissionfiles, $PAGE->context->id, 'mod_eassessment', 'submission', $submission->id, $fileoptions);
Getting files:
$fs = get_file_storage();
$submissionfiles = $fs->get_area_files($this->eassessment->get_context()->id, 'mod_eassessment', 'submission', $this->id, "id", false);