jfversluis / FilePicker-Plugin-for-Xamarin-and-Windows

FilePicker Plugin for Xamarin and Windows
MIT License
157 stars 80 forks source link

FIlepath is not return the right path from download folder on Android #145

Closed miniatarule closed 5 years ago

miniatarule commented 5 years ago

Expected Behavior

When select a file from the download folder on Android. We should get the path of the file. The returning path is: content://com.android.providers.downloads.documents/document/2046

Actual Behavior

The returning path is: content://com.android.providers.downloads.documents/document/2046

Steps to Reproduce the Problem

1) FileData fileData = await CrossFilePicker.Current.PickFile(); if (fileData == null) return; // user canceled file picking

            DocumentPath.Detail = fileName;
           var filePath = fileData.FilePath;

2) . fileData.FilePath ==> is not working for all directories

Specifications

vividos commented 5 years ago

We should put a note prominent notice somewhere, as this comes up again and again... The readme.md has the following:

/// Full file path of the picked file; note that on some platforms the
/// file path may not be a real, accessible path but may contain an
/// platform specific URI; may also be null.
public string FilePath { get; }

Please don't rely on the FilePath to contain an actual path; use GetStream() instead and read from the steam. Thanks!