I need full path from the directory ? #1171

Open
opened 2021-03-11 00:26:33 +00:00 by megasto · 0 comments
megasto commented 2021-03-11 00:26:33 +00:00 (Migrated from github.com)

hi, Im trying to get the native path but I don't know how
I can only preview the name of files as seems :

getFiles(): FileLikeObject[] {
  //this.fileUploader.addToQueue()
  return this.fileUploader.queue.map((fileItem) => {
    //alert(fileItem.file)
    
    return fileItem.file ;
    
  });
}
<input type="file"  ng2FileSelect [uploader]="fileUploader" multiple  />


  <h2>Your files: {{ fileUploader?.queue?.length }}</h2>
  <ul>
    <li *ngFor="let item of fileUploader.queue">
      {{ item?.file?.name }}
    </li>
  </ul>

my approach is to use addToQueue() and append the new parameter :path
and the getFiles() method will rerturn:

[
  {
    "rawFile": {},
    "size": 4904,
    "type": "image/jpeg",
    "name": "img-name.jpg",
	"path": "c:/ddedd/dfddf/imagename.jpeg"  // <= the full path 
  },
  {
    "rawFile": {},
    "size": 4904,
    "type": "image/jpeg",
    "name": "img-name.jpg",
	"path": "file:///storage/emulated/0/DCIM/Camera/20210128_180131.jpeg"  // <= the full path from android devices
  }
]

note :

  • the input should multiple
    I hope anyone gives help and the best approach
hi, Im trying to get the native path but I don't know how I can only preview the name of files as seems : ``` getFiles(): FileLikeObject[] { //this.fileUploader.addToQueue() return this.fileUploader.queue.map((fileItem) => { //alert(fileItem.file) return fileItem.file ; }); } ``` ``` <input type="file" ng2FileSelect [uploader]="fileUploader" multiple /> <h2>Your files: {{ fileUploader?.queue?.length }}</h2> <ul> <li *ngFor="let item of fileUploader.queue"> {{ item?.file?.name }} </li> </ul> ``` my approach is to use **addToQueue()** and append the new parameter :**path** and the **getFiles()** method will rerturn: ``` [ { "rawFile": {}, "size": 4904, "type": "image/jpeg", "name": "img-name.jpg", "path": "c:/ddedd/dfddf/imagename.jpeg" // <= the full path }, { "rawFile": {}, "size": 4904, "type": "image/jpeg", "name": "img-name.jpg", "path": "file:///storage/emulated/0/DCIM/Camera/20210128_180131.jpeg" // <= the full path from android devices } ] ``` note : - the input should **multiple** I hope anyone gives help and the best approach
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: dc/ng2-file-upload#1171