Making sure that form data creates directories before writing files