Domanda

What is the best practice to implement file uploads using Restler framework?

I like to have a API call that get the file save it in CDN and return back the CDN file URL to the caller. What is the best way to implement it?

È stato utile?

Soluzione

File upload to CDN using our API

This requires two steps, first is to get the file on the API server.

  1. add UploadFormat to the supported formats
  2. Adjust the static properties of UploadFormat to suit your need
  3. From your api method use $_FILES and move_uploaded_file to get the file to the desired folder. This step is common for any php upload process.

Now that you have the file on the server

  1. Upload it to CDN. You can use any means provided my your CDN. It can be ftp or using some SDK to do the upload
  2. Construct the CDN url and return it to the client
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top