Click here to Skip to main content
15,888,270 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I want to draw a image on canvas where the source for image will be set dynamically by user.I am getting following error 'Not allowed to load local resource: file:///D:/My%20Picsb.jpg' while trying to set src for image.Is there any way to load file from local drives to draw them on canvas?
JavaScript
var img = new Image();
    img.onload = function () {  
        context.drawImage(img, 20, 20, 50, 50);
    };

    img.src = "D:\My Pics\tb.jpg";
Posted

1 solution

JavaScript - for security reasons - don't let you access the local computer. You are closed inside the browser (sandbox)...
 
Share this answer
 

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