# Get image from file.dataDirectory returns 404 not found (after normalizeURL)

**URL:** <https://forum.ionicframework.com/t/get-image-from-file-datadirectory-returns-404-not-found-after-normalizeurl/115304>\
**Category:** ionic-v3\
**Created:** [December 13, 2017, 7:19pm UTC](https://forum.ionicframework.com/t/get-image-from-file-datadirectory-returns-404-not-found-after-normalizeurl/115304 "2017-12-13T19:19:23Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![rklerck](https://avatars.discourse-cdn.com/v4/letter/r/5e9695/32.png) [@rklerck](https://forum.ionicframework.com/u/rklerck)\
**Post date:** [December 13, 2017, 7:19pm UTC](https://forum.ionicframework.com/t/get-image-from-file-datadirectory-returns-404-not-found-after-normalizeurl/115304/1 "2017-12-13T19:19:23Z")

</div>

I’m trying to show a image in my view which is stored in the dataDirectory of the app. But when I set the image in the src tag, it returns a 404.

First I save the image returned from an api into the dataDirectory and normalize the URL:

```auto
this.file.writeFile(this.file.dataDirectory, filename, blob, { replace: true })
.then(function(fileEntry) {
	store.photoData = normalizeURL(fileEntry.nativeURL);
	resolve();
});

```

The normalized url of the image looks like this:

[http://localhost:8080/var/mobile/Containers/Data/Application/1758E3DC-66D3-4481-8835-79C7841A540A/Library/NoCloud/1510162340797.jpg](http://localhost:8080/var/mobile/Containers/Data/Application/1758E3DC-66D3-4481-8835-79C7841A540A/Library/NoCloud/1510162340797.jpg)

Then I use it in my view:

`<img *ngIf="store.photoData" [src]="store.photoData" />`

Any ideas how to use a local resource image in a src tag? I don’t want to convert it back to base64.

---

<div class="post-metadata">

**Author:** ![rklerck](https://avatars.discourse-cdn.com/v4/letter/r/5e9695/32.png) [@rklerck](https://forum.ionicframework.com/u/rklerck)\
**Post date:** [December 14, 2017, 7:22pm UTC](https://forum.ionicframework.com/t/get-image-from-file-datadirectory-returns-404-not-found-after-normalizeurl/115304/2 "2017-12-14T19:22:02Z")

</div>

Yes! Found the answer myself!

> <https://stackoverflow.com/questions/47835922/ionic-3-get-image-from-file-datadirectory-returns-404-not-found-after-normali/47871268#47871268>

---

<div class="post-metadata">

**Author:** ![mhartington](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/mhartington/32/137757_2.png) [@mhartington](https://forum.ionicframework.com/u/mhartington)\
**Post date:** [July 19, 2021, 9:59pm UTC](https://forum.ionicframework.com/t/get-image-from-file-datadirectory-returns-404-not-found-after-normalizeurl/115304/3 "2021-07-19T21:59:20Z")

</div>

Closed on July 19, 2021, 9:59pm UTC


