I have an existing code sample that I am trying to modify.
My existing code in the view.
c# Code:
using(Html.BeginForm("PostPhoto", "home")) { <p>Your status</p> <input type="text" name="status" id="status" value="" placeholder="Think of something" /> <input type="submit" value="Post" /> }
I now want to add a file input to this form.
So I did this.
c# Code:
using(Html.BeginForm("PostPhoto", "home", FormMethod.Post, new { enctype = "multipart/form-data" })) { <p>Your status</p> <input type="text" name="status" id="status" value="" placeholder="Think of something" /> <input type="file" name="filepath" /> <input type="submit" value="Post" /> }
When I load the page in the browser, it gives me an option to browse and select the file. How do I process this file in my controller?
In my controller, I get the following message.
Could not find file 'C:\Program Files\Common Files\Microsoft Shared\DevServer\11.0\System.Web.HttpPostedFileWrapper'.
How do I make this work with file uploads?


Reply With Quote
