Fixed the filename for uploaded files

This is a backport of #160 for the 1.0.x branch