Hi Kurli,
Try to call a microflow on a button to view document and let microflow contain an activity of download file and please check the box in that activity, so that file will not download automatically instead you’ll have a preview of that file initially.
For getting the error message again try to call a microflow for upload button as well in that way you can check the size of uploaded file and you can show the message appropriately based on file size