start
upload new file
 (single or multiple)
no
yes
transfered without error?
($_FILES['inputname']['error'])
yes
end
uploadFile() 
will return
the error message for the 
associatedfile 
and will be displayed
to the user and file will be 
deleted from files/tmp
if validator
 error
move file
to files/tmp with 
uniqid
(starts with mfuid)
appended

yes
no
error on moving
file to
files/tmp?
create new tl_files
model
for the file
yes
error on creating
 new tl_files model

run fields callback
(validate_upload_callback)
yes
callback return
error message (string?)

Upload process is finished, file 
lies in files/tmp now
but not stored
in field entity yet.
(requires valid form submit)
Field configuration (DCA)
has "uploadFolder"
declared within "eval"?
no
Form submitted 
by user
yes
yes
no
Is field mandatory and 
files were submitted?
Add releated widget error. 
Form submission is invalid,
no callbacks were trigged.
Run moveFiles()
(now files from files/tmp 
getting moved
to "eval" -> "uploadfolder"
no
Is the "uploadfolder"
a valid path?
throw
"uploadNoUploadFolderDeclared"
 Exeption
Loop over all
submitted files by their submitted
uuid.
run validator()
no
Are the submitted files
valid string uuids?

delete files from files/tmp that
did the user upload but not
submit
run fields callback
(upload_path_callback)
move files to the given
target (uploadfolder, or
callback return path),
remove uniqid (starts with mfuid) and
get unique file name within folder (append  _1, _2)
run TL_HOOKS 
'postUpload' and commit 
moved file paths