Recent

Author Topic: [SOLVED] GetRealPathFromURI Not Work on Android 15  (Read 784 times)

nullpointer

  • New Member
  • *
  • Posts: 40
  • impossible is nothing
    • tauhidslab
[SOLVED] GetRealPathFromURI Not Work on Android 15
« on: June 28, 2025, 03:06:36 pm »
Hi,

I'm trying to upload a file form Android to Server (PHP)

Open the file using Intent -> GetRealPathFromURI (get file path) from GetDataUri(intentData). It work on Android 12 but doesn't on Android 15 (return empty string).

Whats wrong? is there any change permission in Android 15?
« Last Edit: June 29, 2025, 12:23:04 pm by nullpointer »

gues1

  • Guest
Re: GetRealPathFromURI Not Work on Android 15
« Reply #1 on: June 28, 2025, 05:38:09 pm »
May be this can help ?

https://developer.android.com/reference/android/Manifest.permission#READ_EXTERNAL_STORAGE

There are some links insde.

This change with API 33.

nullpointer

  • New Member
  • *
  • Posts: 40
  • impossible is nothing
    • tauhidslab
Re: [SOLVED] GetRealPathFromURI Not Work on Android 15
« Reply #2 on: June 29, 2025, 12:27:54 pm »
Solved my problem using following steps:

Copy file to app’s internal or cache directory then upload it.

Code: Pascal  [Select][+][-]
  1. CopyFileFromUri(IntentManager1.GetDataUri(intentData),GetEnvironmentDirectoryPath(dirDownloads));
  2. filePath:=GetEnvironmentDirectoryPath(dirDownloads)+'/'+GetFileNameByUri(IntentManager1.GetDataUri(intentData));
  3.  
  4. if FileExists(filePath) then
  5.       HttpClient1.UploadFile('http://192.xx.xx.xx/webapi/uploadfile.php', filePath, 'fileupload')
  6.     else
  7.       ShowMessage('File does not exist at: ' + filePath);

 

TinyPortal © 2005-2018