0

I upload a file from my local path and then I want to display the image as preview on hovering the link. But I always get this error:

Not allowed to load local resource: file:///C://Users//Public//Pictures//ResimKayit/test_2018112116256.jpg

I tried a lot of solutions, but they didn't work. Is there anyone who can help me?

 <link href="http://codegena.com/assets/css/image-preview-for-link.css" rel="stylesheet" />
    <script type="text/javascript">
        $(function () {
            $('#td1 a').miniPreview({ prefetch: 'pageload' });
        });
    </script>
    <script src="http://codegena.com/assets/js/image-preview-for-link.js"></script>
<td id="td1">
    <a href='<%#GetPrameterValue("FILELOCATION") + "/" + Eval("FILENAME")%>' onclick="OpenAnExternalFile('<%# GetPrameterValue("FILELOCATION") + "/" + Eval("FILENAME") %>')"><%# Eval("FILENAME") %></a>
    <asp:HiddenField ID="hdnID" runat="server" Value='<%#Eval("ID")%>' />
    <asp:HiddenField ID="hdnName" runat="server" Value='<%#Eval("FILENAME")%>' />
 </td>
Krisztián Balla
  • 19,223
  • 13
  • 68
  • 84
  • 1
    You have to load it from a server/local server from your computer - it's a security measure to prevent other websites loading files from your computer without your permission. – Kody R. Nov 28 '18 at 14:50
  • Check this out: https://stackoverflow.com/questions/39007243/cannot-open-local-file-chrome-not-allowed-to-load-local-resource – Katie.Sun Nov 28 '18 at 14:57

1 Answers1

0

Try looking at this question it seems like you are in a similar situation

THREE.js - Can't load texture locally

They were trying to use a texture for three.js but the same security protocol stopped them from loading an image. You could probably use one of their solutions to get around this.

Joseph
  • 16
  • 8