Image Uploading

ADD NAMESPACE IN USING

image.png

  • CREATE VIEW FOR SELECTED ACTIONMETHOD

image.png

-MODEL CLASS WITH BE TABLES NAME .CS image.png

-VIEW .CSHTML SORRY TABLE NAME WAS Artdetail NOT INIBUYER SO DONT GET DISTRACTED BY INIBUYER

image.png

-IT WILL TAKE IMAGE TO FOLDER INSIDE THE PROJECT AND TO ADD HttpPostedFileBase YOU HAVE TO INCLUDE using System.Web;

image.png

  • WHERE YOU WANT TO DISPLAY A BUTTON CHOOSE FILE

image.png

-GO UP IN IMAGEEDIT.CSHTML FILE AND YOU WILL SEE FORM BEGIN LIKE

image.png

-WRITE "ACTIONRESULT NAME", "CONTROLLERNAME", FormMethod.Post, new { enctype = "multipart/form-data" })

image.png

-Now it will store every picture in image folder and path in sql table so when ever we will try to retrieve image it will get path from sql table and get into folder made in project earlier that's it.