Improve folder upload error handling.

It should not happens (handled in views/folder) but if it does, we immediately return -1 so the new files will be randomly ordered between themselves