I have in my "Upload" view the following code:
<form action="" method="post" enctype="multipart/form-data">
<label for="file">Filename:</label>
<input type="file" name="file" id="file" />
<input type="submit" />
</form>
And in my controller "SubidaController" the following
public ActionResult Subida()
{
return View();
}
I need that from the form of my view I can load an image and then go to the index and see it there. That is to say that when uploading an image it must be saved within a physical directory of my project so when restarting or reloading the page the images are not lost. I have searched and tried the methods using sites like this http://haacked.com/archive/2010/07/16/uploading-files-with-aspnetmvc.aspx/ but have not achieved what I need.
edited
Here I found the way to do it, the only problem I have is that they are not shown on my Home page, they are only saved in the "images" folder of my project http://www.dotnetdreamer.net/upload-imagedisplay-image -in-aspnet-mvc
welcome to SOes, there are several ways to achieve what you say, here I give you a simple one:
In the controller where you
GET
do theIndex
In the view
Successes and blessings with programming, give it all the power 2.0! You're on the right track :D
Update
I have the folder
Uploads
in the root of the project:In the controller
Home
:In the view: Views\Home\Index :
Resulting: