Firebase Storage upload from a Raspberry pi 4 with Code::Blocks and C++

January 3, 2024, 16:27

itsrocketman.

I am encountering challenges while attempting to upload a video to Firebase Storage. Specifically, I am using a Raspberry Pi 4, Code::Blocks, and implementing the code in C++. To clarify, I have tried to use the Firebase library but no chance. So i would like NOT to use it when possible. Facing a lot of issues with that and cant find a good doc how to use it on a desktop program instead of an android/ios app... The project involves the creation of a program for motion and object detection. When motion is detected, a video is recorded and saved to local storage. However, I am facing issues when attempting to send this video to Firebase Storage. New Error message:
<html><head>
<meta http-equiv="content-type" content="text/html;charset=utf-8">
<title>404 Page not found</title>
</head>
<body text=#000000 bgcolor=#ffffff>
<h1>Error: Page not found</h1>
<h2>The requested URL was not found on this server.</h2>
<h2></h2>
</body></html>
Thank you in advance! Sorry, there is not enough space for all my code. 😦 You can find it on Stackoverflow under the same title or ask and i can send more as comment ^^
void uploadToFirebaseStorage(const std::string&localFilePath,const 
std::string&firebaseStorageUrl,const std::string&firebaseApiKey){
    CURLcurl;
    CURLcode res;

    curl_global_init(CURL_GLOBAL_DEFAULT);
    curl=curl_easy_init();

    if(curl){
    std::ifstream file(localFilePath,std::ios::binary);
//...

int main(int argc,char*argv){
    //..
    std::string localFilePath="/media/raspi/videos/output_2024010315.avi ";
    std::string firebaseStorageUrl=" nameIcopyfromtheStorage.appspot.com/Video ";
    std::string firebaseApiKey="......";
    uploadToFirebaseStorage(localFilePath,firebaseStorageUrl,firebaseApiKey);
    //..
    if(video_writer.isOpened()){
    video_writer.release();
    }

    }
(And sorry for posting this again. Deleted the text and didnt know how can i add it again. Just wanted to fix it xD )

itsrocketman.

solved it