Uploading your pictures directly into the cloud

Yesterday I found some time to make an example of image push to the Cloud using Seafile storage. The idea is that instead of making a regular file upload that needs some kind of Backend gallery to preview the pictures, we can have a different take, like pushing the picture directly to your Cloud-storage.

WiFi Camera (C++) > API Endpoint (PHP) > Seafile cloud (Python/C)

So the first thing I tried is to browse the Seafile Web API manual and repeat in command line the curl commands. And then I found in packagist this great library that is a wrapper for all commands to implement them easily on your script.

For sure this would be also possible to do it without the middleware PHP, directly in C++ on the Espressif SoC, but I would like to have proper error handling and also to save a copy of the image in the case that the Cloud->push fails for any reason. It can be also a very complicated task considering they are at least 3 API calls using the bearer Auth token.

SeaUP

Short for Seafile upload this a code-example to make a PHP File upload using Seafile API and a simple JSON configuration

2- Edit the sea-config.json and add it along with your seafile server and repository ID settings

{
"seafile_host": "https://storage.luckycloud.de",
"token": "14fd3c026886e3121b2ca630805ed425c272Xxxx",
"repository_id": "Is on the last part of Url when opening a library: #my-libs/lib/REPOSITORY_ID"
}

3- That’s it ! You are ready to open the test provided in the github repository and see if the image appears on the cloud﻿