Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How does JQuery work with files

Can JQuery/JavaScript read/get the file content on the client side, where the file is an image or a text, and store it in a variable?

EDIT: can the file putted in the be handled on the client??

like image 756
CoffeeCode Avatar asked Jan 19 '26 10:01

CoffeeCode


2 Answers

This isn't possible, for obvious reasons once you think about the possible uses:

$(function() { //This doesn't work, just an example
  $.getFile("C:\YourPasswords.txt");
});

I'm sure that wouldn't be abused at all :)

like image 151
Nick Craver Avatar answered Jan 22 '26 01:01

Nick Craver


No, javascript or any javascript library is not able to read contents from disk clientside.

You would have to use an external plugin wich allows for that such as Java.

like image 42
Ikke Avatar answered Jan 22 '26 01:01

Ikke



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!