Search code examples
phponedrive

How to upload files from my site with php to my personal onedrive account?


I would like to allow my users to upload files from an html / php form from my site to my personal onedrive account. Then get the sharing links from these files.

I looked at microsoft.com and stackoverflow, but I do not understand how to upload the file directly into my account and not the user's. Thank you very much for helping me find the trick or the piece of code to make it happen! https://learn.microsoft.com/en-us/onedrive/developer/rest-api/concepts/upload?view=odsp-graph-online


Solution

  • Use flysystem. https://flysystem.thephpleague.com/docs/usage/filesystem-api/

    Then all your storage stuff uses a really easy to use similar API. Then just add the onedrive adapter, and you can call it the same way you call any of the others :-)

    https://packagist.org/packages/nicolasbeauvais/flysystem-onedrive