2

Currently I've launched a WebView in my Android Application to display my MVC 4 Web Application.

In this web app I have a button that triggers an Android function which at the moment, initializes a scanner and stores the scanned image onto the phone. Is there simple approach to upload this image to the web application server since the Android device will be accessing it through the WebView?

And I was wondering if there were any more recent tutorials on uploading images from Android to ASP.NET MVC 4, the only ones I have found so far are done using php or are quite outdated which I kind of wanted to avoid unless definitely needed.

Thanks in advance.

1 Answer 1

3

I think this answer will help you out.

And in your ASP.NET MVC you need your controller set up as

[HttpPost]
 public ActionResult UploadImage(HttpPostedFileBase file) {

 if (file.ContentLength > 0) {
var fileName = Path.GetFileName(file.FileName);
var path = Path.Combine(Server.MapPath("~/App_Data/uploads"), fileName);
file.SaveAs(path);
}

return RedirectToAction("Index");
}
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.