“Not allowed to load local resource: file:///C:…jpg” Java EE Tomcat

后端 未结 8 1544
忘了有多久
忘了有多久 2020-11-29 06:36

I\'m trying to retrieve a picture from my file system after a good storage,(instead of putting it in the database I copy it to the disc and i put the path to the db)

8条回答
  •  悲哀的现实
    2020-11-29 06:52

    Many browsers have changed their security policies to no longer allow reading data directly from file shares or even local resources. You need to either place the files somewhere that your tomcat instance can serve them up and put a "regular" http url in the html you generate. This can be accomplished by either providing a servlet which reads and provides the file putting the file into a directory where tomcat will serve it up as "static" content.

提交回复
热议问题