Android Question Save downloaded file to Folder

Declan

Well-Known Member
Licensed User
Longtime User
Looking at:
B4X:
https://www.b4x.com/android/forum/threads/download-image-or-file-from-a-website.39412/
I have the following in JobDone:
B4X:
    If Job.Success Then
        If Job.JobName.StartsWith("j") Then
            Dim MyFinalName As String
            MyFinalName = sf.Mid(Job.JobName,2, Job.JobName.Length - 1)
            Dim out As OutputStream = File.OpenOutput(File.DirRootExternal & "/eBuki/Downloads/", MyFinalName, False)
            File.Copy2(Job.GetInputStream, out)
            out.Close '<------ very important
        End If
    Else
        Log("Error: " & Job.ErrorMessage)
    End If
    Job.Release

In the Root of the device I have a folder "eBuki" which holds a folder "Downloads"
With the above code, I am copying the downloaded file into the /eBuki/Downloads folder.
I get no error, but the file does not show in the Downloads folder
 

ronell

Well-Known Member
Licensed User
Longtime User
B4X:
 Dim out As OutputStream = File.OpenOutput(File.DirRootExternal, MyFinalName, False)
try first without folder,

also post the relevant code.. not only the jobdone event

edit: i think the problem is that there is no available data to be downloaded in your inputstream
 
Last edited:
Upvote 0
Top