asp.net mvc - How do I seed my MVC model with HttpPostedFileBase type? -


I searched high and low for this answer but nothing can be found ... is I silly ?

  protected override zero seed (MyContext reference) {context.Items.Add (new item {URL = "my-url-field", title = "my title for this item", image = "Some-image-file.jpg" // it is httppostedfilebase - how to seed it?}); }   

I think I have to migrate the httppostedfilebase object, but how do I do it?

I think the HttpPostedFileBase is the wrong asset for your model. You probably want the image property as byte [] instead - this is the data that will be stored in the database. If you need a filename, you can ensure that a string property item

  ... image = file. Redballts ("some-image-file.jpg"), file name = "some-image-file.jpg" ...    

Comments

Popular posts from this blog

excel vba - How to delete Solver(SOLVER.XLAM) code -

github - Teamcity & Git - PR merge builds - anyway to get HEAD commit hash? -

ios - Replace text in UITextView run slowly -