Fix bug in upload method with multiple files