Patch for avoiding empty files in upload.