Page 1 of 1

libURLDownloadToFile issue

Posted: Wed Feb 18, 2026 5:57 pm
by pink
So I have a hiccup I can't seem to fix. I am trying to download a file (mp3).

So 2 things:
1. I can test out the URL in a browser and the file downloads.
2. Livecode does have access to my Downloads folder (using MacOS).

I keep getting the failure message, and I am not sure if I am just missing something simple.
(The link is real for testing purposes.)

Code: Select all

command mp.downloadFile
   put "https://unmixr.s3.amazonaws.com/a/167eb769-a1b9-47ac-b7ae-86ae6e5af3ed.mp3" into tURL
   put "/home/madpink/unmixr/test.mp3" into tFile
   
   libURLDownloadToFile tURL, tFile, "DownloadComplete"
end mp.downloadFile
      
on DownloadComplete pUrl, pStatus
   if pStatus = "Downloaded" then
      answer information "File download!"
   else
      answer warning "File failed to download."
   end if
   unload url pUrl
end DownloadComplete

Re: libURLDownloadToFile issue

Posted: Wed Feb 18, 2026 6:19 pm
by Klaus
Hi Greg,

what is in URLstatus at that time?

Code: Select all

on DownloadComplete pUrl, pStatus
   if pStatus = "Downloaded" then
      answer information "File download!"
   else

     ## Check it right here:
      answer warning "File failed to download." & CR & pStatus
   end if
   unload url pUrl
end DownloadComplete
Best
Klaus

Re: libURLDownloadToFile issue

Posted: Wed Feb 18, 2026 6:32 pm
by richmond62

Re: libURLDownloadToFile issue

Posted: Wed Feb 18, 2026 7:52 pm
by pink
Hi Klaus!

I just get:

Code: Select all

File failed to download.
error
Klaus wrote:
Wed Feb 18, 2026 6:19 pm
Hi Greg,

what is in URLstatus at that time?

Code: Select all

on DownloadComplete pUrl, pStatus
   if pStatus = "Downloaded" then
      answer information "File download!"
   else

     ## Check it right here:
      answer warning "File failed to download." & CR & pStatus
   end if
   unload url pUrl
end DownloadComplete
Best
Klaus

Re: libURLDownloadToFile issue

Posted: Wed Feb 18, 2026 8:10 pm
by Klaus
Ah, hm, sorry, was worth a try...

Re: libURLDownloadToFile issue

Posted: Wed Feb 18, 2026 9:57 pm
by richmond62
I wonder why you are using libURL when you could use

Code: Select all

go url "https://unmixr.s3.amazonaws.com/a/167eb769-a1b9-47ac-b7ae-86ae6e5af3ed.mp3"
?

Possibly like this:

Code: Select all

command mp.downloadFile
   put "https://unmixr.s3.amazonaws.com/a/167eb769-a1b9-47ac-b7ae-86ae6e5af3ed.mp3" into tURL
   put "/home/madpink/unmixr/test.mp3" into tFile
   
   go url tURL, tFile, "DownloadComplete"
end mp.downloadFile
      
on DownloadComplete pUrl, pStatus
   if pStatus = "Downloaded" then
      answer information "File download!"
   else
      answer warning "File failed to download."
   end if
   unload url pUrl
end DownloadComplete

Re: libURLDownloadToFile issue

Posted: Wed Feb 18, 2026 10:24 pm
by pink
I didn't get anything with go url, no files were saved or downloaded, and it didn't trigger DownloadComplete
richmond62 wrote:
Wed Feb 18, 2026 9:57 pm
I wonder why you are using libURL when you could use

Code: Select all

go url "https://unmixr.s3.amazonaws.com/a/167eb769-a1b9-47ac-b7ae-86ae6e5af3ed.mp3"
?

Possibly like this:

Code: Select all

command mp.downloadFile
   put "https://unmixr.s3.amazonaws.com/a/167eb769-a1b9-47ac-b7ae-86ae6e5af3ed.mp3" into tURL
   put "/home/madpink/unmixr/test.mp3" into tFile
   
   go url tURL, tFile, "DownloadComplete"
end mp.downloadFile
      
on DownloadComplete pUrl, pStatus
   if pStatus = "Downloaded" then
      answer information "File download!"
   else
      answer warning "File failed to download."
   end if
   unload url pUrl
end DownloadComplete

Re: libURLDownloadToFile issue

Posted: Thu Feb 19, 2026 12:09 am
by bn
Hi Greg,

I tried this on my Mac:

Code: Select all

command mp.downloadFile
   put "https://unmixr.s3.amazonaws.com/a/167eb769-a1b9-47ac-b7ae-86ae6e5af3ed.mp3" into tURL
   put specialFolderPath("desktop") & "/" & "test.mp3" into tFile
   
   libURLDownloadToFile tURL, tFile, "DownloadComplete"
end mp.downloadFile
      
on DownloadComplete pUrl, pStatus
   if pStatus = "Downloaded" then
      answer information "File download!"
   else
      answer warning "File failed to download."
   end if
   unload url pUrl
end DownloadComplete
and it downloaded without Problem. And "File download!" was shown.

Maybe a problem with the file path for the download?

The mp3 file said: this is a test.

Kind regards
Bernd

Re: libURLDownloadToFile issue

Posted: Fri Feb 20, 2026 10:58 am
by bn
Hi Greg,
Did you solve the problem? If so what was the problem?
Kind regards
Bernd