0

I am trying to make preview to my uploading Images. I have wrote a function its works fine but it doesnt return the complete url of file which is selected locally.

function imagePreview(pid, input){

$("#"+pid).attr("src", input.value);
$("#"+pid).fadeIn('slow');
}

Html is

<input type="file" class="round sinput" onchange="imagePreview('img1', this);" name="f_pic" id="f_pic" />

this function loads image.jpg not c:\website\image.jpg (complete path which is required to display image)

thank you

3
  • It can be a security feature of the browser. Have you tried any other browser? Commented May 3, 2012 at 16:18
  • possible duplicate of is it possible to preview local images before uploading them via a form? Commented May 3, 2012 at 16:19
  • It doesn't return a URL because it contains a file (and some meta data about the file), not a URL. Commented May 3, 2012 at 16:19

1 Answer 1

5

You can't know absolute path to local file selected by user. It's forbidden for security reasons.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.