

Change the node's value by removing the fake path Luckily all I needed to do was fix the issue by doing a simple string replace call: That made sense essentially the browser is feeding that lame C:\fakepath\ text in. Both will check the OS and returns the file separator correctly, for example, Windows \ nix. Classic Java example to construct a file path, using parator or System.getProperty('parator').
#File path for image mac code
I have other code for drawing up the images and I know that will work fine, it's just that. This requirement is already implemented in Internet Explorer 8 - the real path to the file will be shown only if the page that contains the control is added to the trusted sites collection of the browser. File file new File(workingDir, filename) (Recommended) Create the file separator manually. Ask Question Asked 8 years, 3 months ago. Instead, the string that is returned by the script, which handles the file information is C:\fakepath. WTF?!Īfter doing some research, I found this blog post, which explained:Īccording to the specifications of HTML5, a file upload control should not reveal the real local path to the file you have selected, if you manipulate its value string with JavaScript. I then checked Internet Explorer and Safari both of them were prepending " C:\fakepath" to the file name.


Everything worked great until I tested the widget in Chrome and found that the value of the input node was being set to C:\fakepath\. I decided to use Dojo's widget so the "Upload" button would look just like every other button within the web application. I was recently working on a project that required providing an AJAX uploading widget to users.
