Fix incorrect DataUploadEvent creation, triggering an assertion failure

I guess this one slipped through the cracks when $user was made global.
readdir is not guaranteed to be in order

readdir's ordering is filesystem-dependent. On many systems, that means it
might as well be random. People uploading archives will reasonably expect the
files to appear in alphabetical order, so we should make sure they do.
Merge pull request #326 from Madoushi90/archive_fixes

handle_archive extension fixes