Fix segfault when user attempts to upload directory.