# File download in custom directory in internal memory

**URL:** <https://forum.ionicframework.com/t/file-download-in-custom-directory-in-internal-memory/126700>\
**Category:** ionic-v3\
**Created:** [April 3, 2018, 8:53am UTC](https://forum.ionicframework.com/t/file-download-in-custom-directory-in-internal-memory/126700 "2018-04-03T08:53:01Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![flycoders\_sourav](https://avatars.discourse-cdn.com/v4/letter/f/e47c2d/32.png) [@flycoders\_sourav](https://forum.ionicframework.com/u/flycoders_sourav)\
**Post date:** [April 3, 2018, 8:53am UTC](https://forum.ionicframework.com/t/file-download-in-custom-directory-in-internal-memory/126700/1 "2018-04-03T08:53:01Z")

</div>

When download the file on that time i want to create a folder of my app name  
Below my code

```auto
 

```

this.platform.ready().then(() =\> {  
// make sure this is on a device, not an emulation (e.g. chrome tools device mode)  
if(!this.platform.is(‘cordova’)) {  
return false;  
}

```
		if (this.platform.is('ios')) {
			this.storageDirectory = cordova.file.documentsDirectory;
		}
		else if(this.platform.is('android')) {
			this.storageDirectory = cordova.file.externalDataDirectory;
		}
		else {
			// exit otherwise, but you could add further types here e.g. Windows
			return false;
		}
	});

```

```auto
download(event,item){
	this.presentToast('Download started..');
	this.platform.ready().then(() => {

	const fileTransfer: FileTransferObject = this.transfer.create();
	let getUrl = this.selectedItem._meta_video_status
	let downloadFileName = getUrl.substr(getUrl.lastIndexOf('/') + 1); 
	//const imageLocation = `${cordova.file.applicationDirectory}www/assets/img/${item}`;
	const url = getUrl;
	var URL = encodeURI(url);
	this.loading = this.loadingCtrl.create({
		content: 'Downloading...',
		});
	this.loading.present();
	fileTransfer.download(URL, this.storageDirectory+ downloadFileName).then((entry) => {
	this.loading.dismissAll();
	this.presentToast('Download complete !');
	}, (error) => {
	 this.presentToast('Download faild, please try again !');
			});
		});
}

```

```auto
Please help me anyone
Thanks
```

---

<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:42pm UTC](https://forum.ionicframework.com/t/file-download-in-custom-directory-in-internal-memory/126700/2 "2021-07-19T21:42:21Z")

</div>

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


