Send picture from android phone to a local web server <p>I've been searching all over and found a bunch of examples of ways to send a picture to a web server. So far none have quite worked for me. Maybe I started in the wrong end but I've already written the code for the controller which is to take care of the received picture.</p> <p>I'm using a Tomcat web server and written all the code on the server side with Spring Tool Suite with the MVC Framework. The controller is written like this:</p> <pre><code>@RequestMapping(value = "/upload", method = RequestMethod.POST) public String handleFormUpload(@RequestParam("name") String name, @RequestParam("file") MultipartFile file) throws IOException { if (!file.isEmpty()) { byte[] bytes = file.getBytes(); // store the bytes somewhere return "redirect:uploadSuccess"; } else { return "redirect:uploadFailure"; } } </code></pre> <p>The .jsp is written like this:</p> <pre><code>&lt;html&gt; &lt;head&gt; &lt;title&gt;Upload a file please&lt;/title&gt; &lt;/head&gt; &lt;body&gt; &lt;h1&gt;Please upload a file&lt;/h1&gt; &lt;form method="post" action="/form" enctype="multipart/form-data"&gt; &lt;input type="text" name="name"/&gt; &lt;input type="file" name="file"/&gt; &lt;input type="submit"/&gt; &lt;/form&gt; &lt;/body&gt; </code></pre> <p></p> <p>So basically what I'd like to know: <br/> How can I write a class/method that sends a picture from my phone to the web server?</p> <p>I appreciate all the help I can get!</p>