# How to select and upload file in ionic

**URL:** <https://forum.ionicframework.com/t/how-to-select-and-upload-file-in-ionic/78520>\
**Category:** cordova\
**Created:** [February 6, 2017, 7:10am UTC](https://forum.ionicframework.com/t/how-to-select-and-upload-file-in-ionic/78520 "2017-02-06T07:10:15Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![sam747](https://avatars.discourse-cdn.com/v4/letter/s/5fc32e/32.png) [@sam747](https://forum.ionicframework.com/u/sam747)\
**Post date:** [February 6, 2017, 7:10am UTC](https://forum.ionicframework.com/t/how-to-select-and-upload-file-in-ionic/78520/1 "2017-02-06T07:10:15Z")

</div>

How to upload pdf file on server using $cordovaFileTransfer plugin. I have a below input field

`<input type="file" onchange="angular.element(this).scope().fileNameChanged(this)">`  
How to get pathForFile here ?

```
$cordovaFileTransfer.upload(url, pathForFile, options).then(function(result) {
 alert('Your image has been successfully uploaded');
},
function(erro)
{
alert("Failed uploading image on server")
});
```
