문제

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?

도움이 되었습니까?

해결책

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
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top