Jump to content

Downloading a file from an API


Go to solution Solved by 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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.