0

Im trying to add a default image from the ~/Content/Images/image.jpg to the HttpPostedFileBase if used doesnt provide an image.

  if (imageRegisterView?.ContentLength == null)
                {
                    imageRegisterView.SaveAs(Server.MapPath("~/Content/Images/adult-1260380_640.jpg"));
                }
Csibi Norbert
  • 780
  • 1
  • 11
  • 35
  • Why you want to add default image in HttpPostedFileBase instead of that you can set a default image in server side, check when HttpPostedFileBase does not have the file so give is server default image path. – Abhay Agarwal Apr 25 '19 at 07:19
  • @AbhayAgarwal good point, I want to do something like that, it would be possible to show me how I will add that path to the server so that it will take that photo instead? – Csibi Norbert Apr 27 '19 at 20:19
  • Check this: https://stackoverflow.com/questions/1601455/how-to-check-file-input-size-with-jquery – Abhay Agarwal Apr 29 '19 at 04:11

0 Answers0