I have a method in a controller named 'Upload' with a parameter HttpPostedFileBase
object,
I posted the file from view and saved it to folder successfully. But When I try to return a JSON string object with below contents, it throws an exception with message:
"Error getting value from 'ReadTimeout' on 'System.Web.HttpInputStream'."
And in case of 'files = files,' line if I delete it, it returns correctly. But I need this data
public string Upload(HttpPostedFileBase files)
{
try
{
if (files != null && files.ContentLength > 0)
{
var path = Path.Combine(Server.MapPath("~/Uploads"), files.FileName);
files.SaveAs(path);
return JsonConvert.SerializeObject(
new
{
files=files,
Passed = true,
Mesaj = "item added"
});
}
}
}