We’re Still Here to Help (Even Over the Holidays!) - find out more here.
Forum Discussion
levi12drie
7 years agoExplorer | Level 3
File upload error code 500
I am trying to upload a PDF in my javascript file but i get server response error code 500. I also need to find what i have to put in the body to upload the pdf file (using netsuite so i cant use the...
levi12drie
7 years agoExplorer | Level 3
"Authorization": 'Bearer '+ key,
"Dropbox-API-Arg":{"path":"/home/yes.pdf","mode":"add","autorename":true,"mute":false,"strict_conflict":false},
"Content-Type": "application/octet-stream"Above the header i am giving.
URL i am using is:
https://content.dropboxapi.com/2/files/upload Here is the pdf from base_64 to utf_8 (partly)
%PDF-1.3
%����
1 0 obj
<</Type/Catalog/Pages 4 0 R/Lang(en-US)/Names 3 0 R/Metadata 5 0 R>>
endobj
2 0 obj
<</Producer(http://bfo.com/products/report?version=1.1.61-r25714)/CreationDate(D:20180703053256-07'00')/ModDate(D:20180703053256-07'00')>>
endobj
3 0 obj
<</Dests 6 0 R>>
endobj
4 0 obj
<</Type/Pages/Kids[7 0 R]/Count 1>>
endobj
5 0 obj
<</Type/Metadata/Subtype/XML/Length 875>>stream
<?xpacket begin='' id='W5M0MpCehiHzreSzNTczkc9d'?>
<x:xmpmeta xmlns:x="adobe:ns:meta/" x:xmptk="BFOXMP 1.1.61-r25714"><rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"><rdf:Description xmlns:pdf="http://ns.adobe.com/pdf/1.3/" rdf:about=""><pdf:Producer>http://bfo.com/products/report?version=1.1.61-r25714</pdf:Producer></rdf:Description><rdf:Description xmlns:xmp="http://ns.adobe.com/xap/1.0/" rdf:about=""><xmp:CreateDate>2018-07-03T05:32:56-07:00</xmp:CreateDate><xmp:ModifyDate>2018-07-03T05:32:56-07:00</xmp:ModifyDate><xmp:MetadataDate>2018-07-03T05:32:56-07:00</xmp:MetadataDate></rdf:Description><rdf:Description xmlns:dc="http://purl.org/dc/elements/1.1/" rdf:about=""><dc:date><rdf:Seq><rdf:li>2018-07-03T05:32:56-07:00</rdf:li></rdf:Seq></dc:date><dc:format>application/pdf</dc:format></rdf:Description></rdf:RDF></x:xmpmeta>
<?xpacket end='r'?>
endstream
endobj
6 0 obj
<</Names[(page1)8 0 R]>>
endobj
7 0 obj
<</Type/Page/MediaBox[0 0 612 792]/Resources<</ColorSpace<</DefaultRGB 12 0 R>>/ProcSet[/PDF/ImageI/Text/XObject]/XObject<</R1 11 0 R/R3 13 0 R>>/Font<</R2 14 0 R/R4 16 0 R>>>>/Contents[9 0 R]/Parent 4 0 R/Annots 10 0 R>>
endobj
8 0 obj
<</Type/Action/S/GoTo/D[7 0 R/XYZ 0 792 0]>>
endobj
9 0 obj
<</Filter/FlateDecode/Length 1748>>stream
x��X�r�6 }�W`�� iF�q'اZ�z��$���!� #��b�TH�n�Q�� ��� i��1E��ݳg/X�kO F a�Ӝ*Ƙ$�SCL �ٺwv���Y��xڛL�� aNT�( �D�QK�� �_ܑ�] "����>���� $�|0R�_��_�W�J#C�UjYD���k�Z���|��������l]/�2�M,�6&ڭg (�I�]�0ЬO�Yt& ����i �ә�<@ >�������K � ����W��_����HCDDc� �r�f#���, �n+ =چ2 �(�T ��ۛ�)�nIx�9�<�cӼ�m��� ��(QA��|� ����������ڑ��`�$��S� ��ø{�q�� 4䗁��ܹ;2v��2]$A ## %�6]� 8�m�i�� >< , ���AAlm�hdcr VM�o�e1�b�vH�ɲ|>�-[��t�摔T� ������u�rI�Ȼ<��f% {J�{ �}��ǫ�Z� rۼج�2%Bt�� A? G�,s7�\vAws��\�w�!$8� �Ah2Z'�U��A 5�4�c�$�2
Y��XTN
���� <z�>r�C��OŲt��Greg-DB
Dropbox Community Moderator
7 years agoThe "content-upload" style endpoints such as /2/files/upload just expect the binary in the request body so you shouldn't have to re-encode the file data after decoding it from base64. In any case, as far as I can tell from our side, the issue here is with parsing the "Dropbox-API-Arg" header, not the body, so that shouldn't be relevant here.
I see you shared the values you're setting, but can you share the actual raw HTTP request headers as they're being sent?
About Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.
The Dropbox Community team is active from Monday to Friday. We try to respond to you as soon as we can, usually within 2 hours.
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, Facebook or Instagram.
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!