Hugo
Hugo

Reputation: 535

How can I retrieve the local path of an image after it being loaded from the web?

Is it possible to get the local path of an image? Let say I have the following piece of code:

<img src="http://myserver/myimg.png" id="myimg"/>

The file should be downloaded somewhere locally. Is it possible to get its path in JavaScript? A string that would look like "C:\Users\blabla".

Upvotes: 1

Views: 459

Answers (3)

saegi
saegi

Reputation: 36

No it's not, you can't access the filesystem from withhin javascript. Why would you like to do that?

Upvotes: 1

Quentin
Quentin

Reputation: 943142

The file should be downloaded somewhere locally.

It could be held only in RAM.

Is it possible to get its path in JavaScript?

No. Even if the browser has cached it to disk, JavaScript doesn't have access to any information about that cache.

Upvotes: 1

James Hill
James Hill

Reputation: 61793

Short answer: No.

JavaScript cannot access a users file system under any circumstances (this would be a security nightmare).

Upvotes: 2

Related Questions