Click here to Skip to main content
15,885,216 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
I have one textarea, one file browser control, and one load button. When the user selects a file and clicks the load button, I want to display the contents of the selected file in the textarea. I would like this solution to be designed in Javascript. It should work on Internet Explorer, FireFox, and Chrome.
Posted
Updated 8-Jun-12 9:35am
v2
Comments
manish kumar3 8-Jun-12 14:54pm    
Help will be appreciable..
Sergey Alexandrovich Kryukov 8-Jun-12 15:22pm    
"contentents in the textg"? Aha...
I'm even uncomfortable about asking the usual "what have you done so far?" or "what's the problem?"... :-)

--SA

1 solution

I'm pretty sure this cannot be done with JavaScript without the data traveling to the server first. However, you can have it travel to the server using AJAX. See here: http://stackoverflow.com/questions/527955/how-can-i-upload-a-file-using-javascript-without-a-postback

Alternatively, you can use Flash and Java (note: not JavaScript) to perform the upload entirely on the client.
 
Share this answer
 
Comments
AspDotNetDev 8-Jun-12 21:06pm    
I just noticed the question was tagged as JSP and not ASP.NET. Assuming JSP can handle AJAX, the principle should be the same. That is, can't do it entirely on the client (the server will have to be involved), unless Java (on the client side) or Flash are used.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900