These forums are currently read-only due to receiving more spam than actual discussion. Sorry.

It is currently Sat Dec 02, 2017 4:04 pm Advanced search

Reading a local txt file with predefined path...

If you are stuck or have questions regarding HTML or other Web technologies, ask your questions here. No question too dumb!

Reading a local txt file with predefined path...

Postby nonlinearly » Tue Mar 12, 2013 7:27 pm

Hi, I recently discover that with HTML 5 can we access the local file system with easy. But regrets that the only way to feed the javascript code with the path of a file that we want to read for example is through the input element of file type. Unfortunately I have not found a way to use a predefine path.
Am I missing something? For that reason I follow another way trying to use specific technologies each browser has to have access to the pc's resources. For example in IE we have ActiveX, in Firefox we have add-ons and XPCOM.

Thanks in advance
nonlinearly
<h6>
 
Posts: 4
Joined: Tue Mar 12, 2013 7:23 pm

Re: Reading a local txt file with predefined path...

Postby zcorpan » Thu Mar 14, 2013 1:02 pm

You can't read files from the user's system without the user's consent, because that would be a huge privacy and security problem. :) The user needs to explicitly "share" a file with your app, either by selecting it in <input type=file> or by dragging it to your app.
zcorpan
<article>
 
Posts: 807
Joined: Tue Feb 06, 2007 8:29 pm
Location: Sweden

Re: Reading a local txt file with predefined path...

Postby nonlinearly » Thu Mar 14, 2013 6:30 pm

Yes, you are right... but it could be if there was an option in the browser that the user explicitly select like so many other security options that there are in the browsers...
And how can I make such functionality... ActiveX in IE and plugins on firefox (I do not know the ActiveX equivalent on Firefox if it is plugins) is the right way?
Thanks for your response...
nonlinearly
<h6>
 
Posts: 4
Joined: Tue Mar 12, 2013 7:23 pm

Re: Reading a local txt file with predefined path...

Postby JAB Creations » Thu Mar 14, 2013 7:57 pm

ActiveX is dead, don't even think about wasting time on proprietary tech that only works with 20% of my site's market share! The plugins will (if they even support file uploads) have very similar functionality but now you're talking third party items that may or may not be installed in the browser that they are using.

A couple links that should help you get moving in the right direction...
W3C: http://www.w3.org/TR/FileAPI/
MDN: https://developer.mozilla.org/en-US/doc ... plications

I made a multiple-image uploader that included thumbnail images of the selected images and accurate upload percentage indicators to show the progress of uploads. I'm not sure if you can get the text from a text file offhand though to me it would be similar if simply text instead of binary data. You're just going to have to do the research.
User avatar
JAB Creations
<aside>
 
Posts: 566
Joined: Tue Mar 13, 2007 4:48 am
Location: Sarasota Florida, USA

Re: Reading a local txt file with predefined path...

Postby nonlinearly » Fri Mar 15, 2013 10:12 am

Sorry... I think that it is very important to mention that all the job is about an intranet application we build that run only on company's network browsers and not outside... So I have the option to use technologies such ActiveX or what else to make easier my life. But I want the application to run on Firefox so what is the equivalent technology in Firefox to read a local text file without input element? I need when the page load to start a continue loop that in every loop read the file for new value (one line text file). So the new idea of "Workers" in HTML 5 was perfect because the loop will run in a separate thread and does not prevent the operation of the rest of the page. But the mandatory use of input element it screwed up...
Thanks...
nonlinearly
<h6>
 
Posts: 4
Joined: Tue Mar 12, 2013 7:23 pm

Re: Reading a local txt file with predefined path...

Postby nonlinearly » Fri Mar 15, 2013 2:31 pm

Ok I found what I have to do... firefox extensions can read and write from the local machine with a predefined path...
Thanks for your response any way...
nonlinearly
<h6>
 
Posts: 4
Joined: Tue Mar 12, 2013 7:23 pm


Return to Help & Advice

Who is online

Users browsing this forum: No registered users and 1 guest