You need to specify the SharedDirectory instead of "File.DirRootExternal", and (correction to my previous post) do NOT use URI for the filename, just use the filename (just make sure the file you want to upload is in the SharedDirectory).
This is code I use to get the SharedDirectory:
B4X:
Sub GetSharedDirectory () As String
Dim SharedFolder As String
Dim RP As RuntimePermissions
Dim p As Phone
If p.SdkVersion >= 24 Or File.ExternalWritable = False Then
SharedFolder = File.Combine(File.DirInternal, "shared")
File.MakeDir("", SharedFolder)
Else
SharedFolder = RP.GetSafeDirDefaultExternal("shared")
End If
Return SharedFolder
End Sub
The READ_EXTERNAL_STORAGE line is already in my Manifest.
Even though it was a TXT file I had also done the test of writing "False" in the writing mode.
Without success !!!
Thanks. At the moment I only have one smartphone with Android 5 and one with Android 8. I'll try with an emulator soon.
The latter does not even have an antivirus that could block traffic. @LucaMs : anche usando DirInternal non funziona