fix file upload method (closes #15)

with thanks to @justmytwospence for the report, and additional testing