Prevent large file uploads in React Ant Design by using beforeUpload to validate size and display an error message.