views:

33

answers:

1

Here's my problem,
i want to make an ID-Card generator site that needs users photo, but i don't want any file to be uploaded to the server
so i decided to working offline with javascript,

here's some part of my code

<html>
<head>
    <title>Try</title>
    <script language="javascript">
        function getFile() {
            document.img1.style.visibility = 'visible';
            document.img1.src = 'file:///' + document.form1.photos.value;
        }
    </script>
</head>
<body>
    <form name=form1>
        <input type=file name="photos" />
        <input type=button onClick="getFile()" value="Open File" />
    </form>
    <img style="visibility:hidden" name=img1 src="" />
    <br>
</body>
</html>

unfortunately, its never worked, and i've done some little research about this,
i know that some browsers didn't return the full path from input file

what i want to know is, how to get full path of the input file
any suggestions?

A: 

You're not supposed to be accessing the client computer like that with JavaScript. That would create massive security problems.

An Input HTML control of type="file" will contain just the file data on submission of the form. The browser handles the display of the path and whatever you see in the file selector.

The browser provides file browsing capabilities as a feature, but should never allow requests from the HTTP protocol to the "file://" protocol (I don't even know if it's a protocol).

palswim