0

I have an <input type="file"> to upload an image file.

The project I work on have CSP settings and what I'm currently getting is this:

Refused to load the image 'c:\fakepath\avatar.jpg' because it violates the following Content Security Policy directive: "img-src * 'self' data: localhost:7331".

  1. How to allow for this kind of upload?
  2. Why is is it sayind fakepath where there is actually a path for this file named differently?
sideshowbarker
  • 81,827
  • 26
  • 193
  • 197
mdmb
  • 4,833
  • 7
  • 42
  • 90
  • As far as the reason for the `fakepath` part, see https://html.spec.whatwg.org/multipage/input.html#fakepath-orly and https://html.spec.whatwg.org/multipage/input.html#fakepath-srsly – sideshowbarker Sep 26 '17 at 22:13
  • 1
    You probably want to edit/update your question to show the relevant part of HTML markup for the document and the JavaScript code you’re trying to us to manipulate that file once it’s uploaded. In the mean time though, you might want to see https://stackoverflow.com/questions/18254118/fakepath-issue-in-chrome-browser/18254337#18254337 and https://stackoverflow.com/questions/6365858/use-jquery-to-get-the-file-inputs-selected-filename-without-the-path/6365883#6365883 – sideshowbarker Sep 26 '17 at 22:14

0 Answers0