libURLDownloadToFile issue

Bringing the internet highway into your project? Building FTP, HTTP, email, chat or other client solutions?

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
pink
Posts: 283
Joined: Wed Mar 12, 2014 6:18 pm

libURLDownloadToFile issue

Post by pink » Wed Feb 18, 2026 5:57 pm

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
Greg (pink) Miller

MadPink, LLC
I'm Mad, Pink and Dangerous to Know

Klaus
Posts: 14303
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: libURLDownloadToFile issue

Post by Klaus » 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


pink
Posts: 283
Joined: Wed Mar 12, 2014 6:18 pm

Re: libURLDownloadToFile issue

Post by pink » Wed Feb 18, 2026 7:52 pm

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
Greg (pink) Miller

MadPink, LLC
I'm Mad, Pink and Dangerous to Know

Klaus
Posts: 14303
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: libURLDownloadToFile issue

Post by Klaus » Wed Feb 18, 2026 8:10 pm

Ah, hm, sorry, was worth a try...

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 10351
Joined: Fri Feb 19, 2010 10:17 am

Re: libURLDownloadToFile issue

Post by richmond62 » 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

pink
Posts: 283
Joined: Wed Mar 12, 2014 6:18 pm

Re: libURLDownloadToFile issue

Post by pink » Wed Feb 18, 2026 10:24 pm

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
Greg (pink) Miller

MadPink, LLC
I'm Mad, Pink and Dangerous to Know

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4204
Joined: Sun Jan 07, 2007 9:12 pm

Re: libURLDownloadToFile issue

Post by bn » Thu Feb 19, 2026 12:09 am

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

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4204
Joined: Sun Jan 07, 2007 9:12 pm

Re: libURLDownloadToFile issue

Post by bn » Fri Feb 20, 2026 10:58 am

Hi Greg,
Did you solve the problem? If so what was the problem?
Kind regards
Bernd

Post Reply