if you want to upload a picture, in the page to achieve a preview, you can get the file upload path, and then in a inside, the file upload path is <input type= The value of the "file"/>. In IE, the value is equal to the local path, however, in Chrome and Firefox, for security reasons, the path is anonymous, for example, upload e-disk readme.txt, the resulting value is c:/fakepath/readme.txt.
To display the uploaded image on the page, you can upload it to the server and then download it to avoid the problem, but there will be excess traffic, not a good practice.
Fortunately, I found a way to solve it:
<! doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "HTTP// Www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">call FileReader's Readasdataurl interface, will start the asynchronous loading file content, by listening to reader an onload event, after loading the data, in the OnLoad event processing, The contents of the file can be obtained by using the result property of reader.
Fix problems with file upload local path hiding in Chrome and Firefox