It is impossible, even referencing to file using file://
won't work as when you get the value from the file input box, you only get the filename, not the path. So it's impossible to know where the image is located. To make it work, you'd have to use a Flash based uploader.
This is surely a safety measure, as Internet Explorer does give you a path, only thing is that it is always c:\fakepath\filename.png
. I guess the browsers are doing their job preventing JavaScript from getting any meaningful information from the filesystem.
The return values for different browsers when trying to upload file C:\test.txt
:
Firefox 3.5.6
test.txt
Chrome 3.0.195.38
test.txt
Opera 10.00
C:\fake_path\test.txt
Internet Explorer 8
C:\fakepath\test.txt