Note that you only have to simulate the server-side of what happens when a user uses the file-picker.
What happens then involves a 'draft' file area. That is, a file area with contextid = user's context, component = 'user', filearea = 'draft' and itemid = some unique ID that the file API gives you.
So, look at how the essay question (renderer) calls ->prepare_response_files_draft_itemid which eventually calls file_prepare_draft_area.
Anyway, what you need to do is to get the draft itemid, and save the file into that draft file area before calling process_submit.
Hey! I am starting to understand this now. Writing this post really helped make it clear to me. I wonder if I will have time to work on this next week?