title: ASP .NET Core MVC : problem with uploading images
body: <p>I have images in folder <code>/wwwroot/upload</code>.</p>
  <p>When I run my application on some pages I can see images on others I can see just crashed ones.</p>
  <p>These are example GET methods after typing F12:</p>
  <pre><code>GET http://localhost:55975/Article/Edit/upload/7d69d935-0ab6-4e82-878f-c19595889004_marynarka.jpg 
  </code></pre>
  <blockquote>
  <p>404 (Not Found)</p>
  </blockquote>
  <pre><code>GET http://localhost:55975/upload/45d9754e-d7e6-4f97-9653-2746304d5b1e_spodnie.jpg 
  </code></pre>
  <blockquote>
  <p>200 OK (from disk cache)</p>
  </blockquote>
  <pre><code>GET http://localhost:55975/Article/Details/upload/297aa78a-64b1-454a-aa26-04eab0897511_szafa.jpg 
  </code></pre>
  <blockquote>
  <p>404 (Not Found)</p>
  </blockquote>
  <p><strong>Edit:</strong></p>
  <p>In my code I have <code>ArticleController</code> and inside it are <code>Details</code> and <code>Edit</code> methods.</p>
  <p><strong>Edit.cshtml:</strong></p>
  <pre><code>@model Shop.Models.Article
  ...
  &lt;img src=&quot;@(Model.Image)&quot;/&gt;
  ...
  </code></pre>
  <p><strong>Details.cshtml:</strong></p>
  <pre><code>@model Shop.Models.Article
  ...
  &lt;img src=&quot;@(Model.Image)&quot;/&gt;
  ...
  </code></pre>
  <p><strong>Index.cshtml:</strong></p>
  <pre><code>@model IEnumerable&lt;Shop.Models.Article&gt;
  @foreach (var item in Model) {
        &lt;tr&gt;
            &lt;td&gt;
              &lt;img src=&quot;@(item.Image)&quot; width=&quot;70px&quot; height = &quot;70px&quot;/&gt;
            &lt;/td&gt;
        &lt;/tr&gt;
  </code></pre>
  <p><strong>Part of CreateArticle method:</strong></p>
  <pre><code>if(image != null)
              {
                  string uniqueName = Guid.NewGuid().ToString() + &quot;_&quot; + Path.GetFileName(image.FileName);
                  var name = Path.Combine(_hostingEnvironment.WebRootPath + @&quot;\upload&quot;, uniqueName);
                  image.CopyTo(new FileStream(name, FileMode.Create));
                  article.Image = &quot;upload/&quot; + uniqueName;
              }
              if(image == null)
              {
                  article.Image = &quot;noimage/NoImage.png&quot;;
              }
  </code></pre>