fixed a weird bug where upload filename was a pathname instead of filename