Vương Vũ Nguyễn
Vương Vũ Nguyễn

Reputation: 106

How to get the local url image path from local disk when browse the image in jquery/Javascript

I have code for preview image and get image name:

$("input[type=file]").on("change", function() {
    $("[for=file]").html(this.files[0].name);
    $("#preview").attr("src", URL.createObjectURL(this.files[0]));
})

However I want to get the local url of image. For example, the image I choose from D:/pic.jpg and I want display this file path. How can I do that? Please help me.

Upvotes: 0

Views: 385

Answers (1)

Charlie
Charlie

Reputation: 23768

No modern browser allow you to get the exact local path of a file. The information your are looking for is limited by the security policy of the browser.

Upvotes: 1

Related Questions