Fix #1307: File upload fails if filename has spaces in it