views:

40

answers:

3

Hello all,

you experts probably knowing the easyiest ways to open/find a file from asp.net mvc application.

could you tell me please how to do that, if i want for example to find and upload a photo from my PC.

Thanks and take care, Ragims

A: 

Two samples:

Christian13467
+2  A: 

This article may help you.

The article will show how to upload a file from client to server location in ASP.Net MVC application in 5 easy steps.

Rippo
A: 

Just a simple HTML file input in your view will suffice:

<input type="file" name="MyFile" id="MyFile" />

Then accept the file in your controller action:

public ActionResult Upload(HttpPostedFileBase myFile)
{
    // save or process file here...

    return View();
}

Also, remember to set <form enctype="multipart/form-data"> in your form.

cxfx