I uploaded image to apache-tomcat-8.0.22\webapp\MyProjectName\ that work fine,
then I want to display such image use <img src='...' />, it's fail because of 404, but I can very sure image is upload success in file system. What realy made me crazy is after about 5 seconds fresh the page then the image can display success!
I want display iamge immediately after uploaded, how to do that?
I use Spring MVC3
code save upload file public String save(MultipartFile mtFile) throws IOException { String filePath = "/" + mtFile.getOriginalFilename(); String fileRealPath = servletContext.getRealPath(filePath); mtFile.transferTo(new File(fileRealPath)); return filePath; }
the filePath will store in database
code display image <image src=${rc.contextPath + filePath} />
the image can display but can't display immedidately
Aucun commentaire:
Enregistrer un commentaire