Rewrite file upload