You might see that the Dropbox Community team have been busy working on some major updates to the Community itself! So, here is some info on what’s changed, what’s staying the same and what you can expect from the Dropbox Community overall.

Forum Discussion

Mikevp05's avatar
Mikevp05
New member | Level 1
10 hours ago

0 bytes when uploading PDF through API

I am using Webflow and Wized to upload a file to Dropbox however when I upload the file the response says size 0 and in dropbox it says 0 bytes and I can't open it. 

    const contentToCapture = document.querySelector('.pdf-content');

    html2canvas(contentToCapture, { scale: 0.75 }).then((canvas) => {
        const base64image = canvas.toDataURL('image/png');
        const pdf = new jsPDF('p', 'px', [canvas.width, canvas.height]);
        pdf.addImage(base64image, 'PNG', 0, 0, canvas.width, canvas.height);

        const pdfBlob = pdf.output('blob');
        v.pdf_data = pdfBlob;
    });

Above is how I create the pdf and convert it to a blob. The pdf itself works fine when I download it. 

This is how the request is set up.

  • Greg-DB's avatar
    Greg-DB
    Icon for Dropbox Staff rankDropbox Staff

    The Dropbox API /2/files/upload endpoint is a "content-upload" type endpoint, meaning it accepts the file data to upload in the request body (as application/octet-stream). So, when uploading file data that way, make sure your network client is sending the desired file data in the request body.

    We can't provide support for third party platforms or tools themselves such as Webflow or Wized, as those aren't made by Dropbox, so you may need to refer to the documentation for those for information on how to configure them accordingly. Looking at the screenshots you shared though, I see for "Body" you have a Key/Value pair, which may not be the configuration you need, since there wouldn't be any sort of "file" parameter or key; the entirety of the request body should be the raw file data.

About Dropbox API Support & Feedback

Node avatar for Dropbox API Support & Feedback

Find help with the Dropbox API from other developers.

5,880 PostsLatest Activity: 3 hours ago
325 Following

If you need more help you can view your support options (expected response time for an email or ticket is 24 hours), or contact us on X or Facebook.

For more info on available support options for your Dropbox plan, see this article.

If you found the answer to your question in this Community thread, please 'like' the post to say thanks and to let us know it was useful!