Skip to main content

I need urgent help for uploading Videos

Comments

3 comments

  • Eric Pasos

    Hi Roman,

    When using Cloudinary SDK to perform the upload using Base64, you can use the actual string format, and there is no need to encode it to escape the especial characters. For example:

    ...
    app.get('/api/uploadlargebase64', function(req, res) {
      const base64Image = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg==';
    const result = cloudinary.uploader.upload_large(base64Image, {
      upload_preset: "your_upload_preset",
        resource_type: "image"
    }, function(error, result) {
        if (error) {
          console.log(error)
        } else {
          console.log(result);
        }
      }
    );
      res.send({
        'uploadresponse': "Upload done!"
      });
    });
    ...

    The data scheme must follow this format:

    data:[<mediatype>][;base64],<data>

    Hope this helps.

    0
  • Roman Armin Rostock

    Hi Eric, I didn't have access to the internet for two days, so I can only answer now. That doesn't work. What is this string behind base64? Does it have to be? I entered it, then my computer crashes. If I don't enter it, then I get endless base64 in my console and my computer also crashes so I can't see the error. Thanks for the help.

    0
  • Eric Pasos

    Hi Roman,

    The example code above is to show the actual data scheme format being provided to the `upload_large()` (i.e., it should not be escaped/encoded). With this, could your try to update your code (and make sure that the buf contains the valid Base64 data as well):

    From:

    .upload_large("%22data%3Avideo/mp4%3B%20base64%22" + buf...)

    To:

    .upload_large('data:image/png;base64,' + buf...)

    Please take a look and do let me know the error logs details if any.

    Thanks.

    0

Post is closed for comments.