Your Spring MVC app running on your server does not access the original file on the client's machine (otherwise websites could do bad things to your computer) - the browser sends a copy of the file over the wire to your controller.
Here is a snippet of code I've used to copy the uploaded file to the server's file system:
@RequestMapping(value = "/upload", method = RequestMethod.POST)
public String uploadFile(
HttpServletResponse response,
@RequestParam(value="filename", required=true) MultipartFile multipartFile,
Model model) throws Exception {
if (!multipartFile.isEmpty()) {
String originalName = multipartFile.getOriginalFilename();
final String baseTempPath = System.getProperty("java.io.tmpdir"); // use System temp directory
String filePath = baseTempPath + File.separator + originalName;
File dest = new File(filePath);
try {
multipartFile.transferTo(dest); // save the file
} catch (Exception e) {
logger.error("Error reading upload: " + e.getMessage(), e);
response.sendError(HttpServletResponse.SC_BAD_REQUEST, "File uploaded failed: " + originalName);
}
}
}