kamal213 Posted June 29, 2012 Share Posted June 29, 2012 Hi guys, Is it possible for a text field on a website to be auto-filled based on what is held within a document locally? For example if we had address.txt on the desktop of a computer is it possible to create a web form to capture what is contained within that file and auto-fill a field? Thanks alot! Quote Link to comment Share on other sites More sharing options...
nogray Posted June 30, 2012 Share Posted June 30, 2012 The only way to read a file local is via ActiveX (IE only) and the user will get a scary warning every time they load your page. Quote Link to comment Share on other sites More sharing options...
.josh Posted June 30, 2012 Share Posted June 30, 2012 If you are looking for a way for visitors to easily auto-fill a form on your site based on a local file, you can make a "step 1" or "first form field" be a file input field for the visitor to upload the file. Have it post with ajax and then use server-side script to parse the file and send back the form field values and pop the form field values. This will keep the visitor on the same form page with minimal effort on their end. That's really the best you can do, other than what nogray mentioned (which is not something you wanna do). It is a security feature/limitation; servers shouldn't be allowed to grab arbitrary stuff off a client's computer. The only client storage the server has access to are cookie files for reading/writing cookies. And even then it's not direct access. HTML5 does promise expanded client-side storage abilities, but a) considering peoples' paranoia about cookies, who knows if it will ever really happen b) it still wouldn't be access to arbitrary files on the clients. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.