Do security checks on temp file and only if they pass, move it to the target_dir.