Jump to content

Downloading a file from an API


rayman0487

Recommended Posts

Hey all!

 

I have a web app that uses cURL to connect to a PHP API. Everything is working fine, but now I need to be able to download a file. My users are able to upload files to the API and they are saved on the server, but now I'm trying to download those files.

 

If i navigate directly to api.php?file=somefile.pdf the API will output the file in the headers and I get the open to save or open the file as expected. Now, what I'm trying to do is get my client application to save the file, but I have no idea what to even Google. Everything I've tried is more about sending files to an API (uploading).

 

So if anyone knows any good resources or how to do this please let me know.

 

Sorry for any shortcomings in this post, but I type it out quickly, as I'm working on multiple things today and this is just one of those and is causing a huge headache.

 

 

Thanks!

Link to comment
https://forums.phpfreaks.com/topic/280348-downloading-a-file-from-an-api/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.