title: How to access the image using path in Flask?
body: <p>I have to use an image that is stored in the directory uploaded/images in Html/javascript file using Flask.</p>
  <pre><code>
  &lt;img id=&quot;img&quot; src= &quot;&quot;&gt;
  &lt;h1 id=&quot;file_path&quot; style=&quot;visibility:hidden&quot;&gt;{{ file_path }}&lt;/h1&gt;
  
  </code></pre>
  <p>and js</p>
  <pre><code>var file_path = &quot;../uploaded/images/&quot; + document.getElementById(&quot;file_path&quot;).innerHTML;
  document.getElementById(&quot;img&quot;).setAttribute(&quot;src&quot;,file_path)
  
  </code></pre>
  <p>And the directory structure looks like this:</p>
  <p>predict.html contains those codes (above).</p>
  <p>The image to be shown is inside uploaded/images.</p>
  <p>home.py is the flask app.</p>
  <p><a href="https://i.stack.imgur.com/q4yID.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/q4yID.png" alt="" /></a></p>