Upload.pm: create helper functions + move code (prepare future commits)
code cleanup: create helper function _store_file_and_register_on_disk
code cleanup: create helper function _template_begin()
code cleanup: create helper function _check_upload_size()
code cleanup: declare vars where they are used
code cleanup: create helper function _new_upload_hook()
code cleanup: remove wrong comments + inline a var
code cleanup: create helper function _template_end()

(hopefully filling the template before sendMail() will not change the semantic)
code cleanup: move more things into _template_begin()
code cleanup: move more things into _template_end() + remove wrong comment
implement special trusted upload to be used with curl

example of use:

curl -F 'upload=@foo.png' -F 'daykeep=1' -F 'owner=foo@univ.fr' https://filex.univ.fr/filex/trusted-upload

you need to add in apache conf:

<Location /filex/trusted-upload>
  Order allow,deny
  Allow from xxx
  SetHandler perl-script
  PerlResponseHandler FILEX::Apache::Handler::Upload
</Location>