<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Files Uploaded are Corrupted After api usage in Discuss Dropbox Developer &amp; API</title>
    <link>https://www.dropboxforum.com/t5/Discuss-Dropbox-Developer-API/Files-Uploaded-are-Corrupted-After-api-usage/m-p/401177#M1049</link>
    <description>&lt;P&gt;It sounds like there may be a problem with how you're transmitting or encoding the data for the upload call. Can you share the problematic code?&lt;/P&gt;</description>
    <pubDate>Fri, 06 Mar 2020 20:48:39 GMT</pubDate>
    <dc:creator>Greg-DB</dc:creator>
    <dc:date>2020-03-06T20:48:39Z</dc:date>
    <item>
      <title>Files Uploaded are Corrupted After api usage</title>
      <link>https://www.dropboxforum.com/t5/Discuss-Dropbox-Developer-API/Files-Uploaded-are-Corrupted-After-api-usage/m-p/401170#M1048</link>
      <description>&lt;P&gt;I tried uploading various documents of types ms word doc and pdf to the site using the standard fread method in my curl postfields input. The files are corrupted and cannot be repaired by a word processor like libreoffice afterwards. I tried encoding the fread in base64, but the corruption still occured. How can I ensure my files are not corrupted when using the api and curl?&lt;/P&gt;</description>
      <pubDate>Mon, 09 Mar 2020 21:04:34 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Discuss-Dropbox-Developer-API/Files-Uploaded-are-Corrupted-After-api-usage/m-p/401170#M1048</guid>
      <dc:creator>FSUInnovation</dc:creator>
      <dc:date>2020-03-09T21:04:34Z</dc:date>
    </item>
    <item>
      <title>Re: Files Uploaded are Corrupted After api usage</title>
      <link>https://www.dropboxforum.com/t5/Discuss-Dropbox-Developer-API/Files-Uploaded-are-Corrupted-After-api-usage/m-p/401177#M1049</link>
      <description>&lt;P&gt;It sounds like there may be a problem with how you're transmitting or encoding the data for the upload call. Can you share the problematic code?&lt;/P&gt;</description>
      <pubDate>Fri, 06 Mar 2020 20:48:39 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Discuss-Dropbox-Developer-API/Files-Uploaded-are-Corrupted-After-api-usage/m-p/401177#M1049</guid>
      <dc:creator>Greg-DB</dc:creator>
      <dc:date>2020-03-06T20:48:39Z</dc:date>
    </item>
    <item>
      <title>Re: Files Uploaded are Corrupted After api usage</title>
      <link>https://www.dropboxforum.com/t5/Discuss-Dropbox-Developer-API/Files-Uploaded-are-Corrupted-After-api-usage/m-p/401180#M1050</link>
      <description>&lt;PRE&gt;$dropbox_url_upload = "https://content.dropboxapi.com/2/files/upload";
	$opendoc = fopen($filename, 'rb');
	$docsize = $doc['size'];
	$d1curl = curl_init();
	curl_setopt($d1curl, CURLOPT_URL, $dropbox_url_upload);
	curl_setopt($d1curl, CURLOPT_TIMEOUT, $timeout);
	curl_setopt($d1curl, CURLOPT_HTTPHEADER, [
		utf8_encode('Authorization: Bearer ' . $dropbox_token),
            'Content-Type: application/octet-stream',
            'Dropbox-API-Arg: '.
            json_encode(
                array(
                    "path"=&amp;gt; $dropbox_directory,
                    "mode" =&amp;gt; "add",
                    "autorename" =&amp;gt; true,
                    "mute" =&amp;gt; false
	))]);
	curl_setopt($d1curl, CURLOPT_POST, true);
	curl_setopt($d1curl, CURLOPT_POSTFIELDS, base64_encode(fread($opendoc, $docsize)));
	curl_setopt($d1curl, CURLOPT_RETURNTRANSFER, true);
	$dropbox_upload = curl_exec($d1curl);
	$http_request = curl_getinfo($d1curl, CURLINFO_HTTP_CODE);
	echo $dropbox_upload;
	echo $http_request;
	curl_close($d1curl);
	fclose($opendoc);&lt;/PRE&gt;</description>
      <pubDate>Fri, 06 Mar 2020 21:01:16 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Discuss-Dropbox-Developer-API/Files-Uploaded-are-Corrupted-After-api-usage/m-p/401180#M1050</guid>
      <dc:creator>FSUInnovation</dc:creator>
      <dc:date>2020-03-06T21:01:16Z</dc:date>
    </item>
    <item>
      <title>Re: Files Uploaded are Corrupted After api usage</title>
      <link>https://www.dropboxforum.com/t5/Discuss-Dropbox-Developer-API/Files-Uploaded-are-Corrupted-After-api-usage/m-p/401183#M1051</link>
      <description>&lt;P&gt;I see you're adding a layer of base64 encoding via your call to&amp;nbsp;base64_encode. You should not&amp;nbsp;base64 encode the file data when uploading it. Try removing that base64_encode call.&lt;/P&gt;</description>
      <pubDate>Fri, 06 Mar 2020 21:18:51 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Discuss-Dropbox-Developer-API/Files-Uploaded-are-Corrupted-After-api-usage/m-p/401183#M1051</guid>
      <dc:creator>Greg-DB</dc:creator>
      <dc:date>2020-03-06T21:18:51Z</dc:date>
    </item>
    <item>
      <title>Re: Files Uploaded are Corrupted After api usage</title>
      <link>https://www.dropboxforum.com/t5/Discuss-Dropbox-Developer-API/Files-Uploaded-are-Corrupted-After-api-usage/m-p/401185#M1052</link>
      <description>&lt;P&gt;It is working now and am able to view the contents on my dropbox viewer. However, when I tried doing it without any encoding yesterday, I also had corruption. What could increase the risk of file corruption when uploading with the api?&lt;/P&gt;</description>
      <pubDate>Fri, 06 Mar 2020 21:27:22 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Discuss-Dropbox-Developer-API/Files-Uploaded-are-Corrupted-After-api-usage/m-p/401185#M1052</guid>
      <dc:creator>FSUInnovation</dc:creator>
      <dc:date>2020-03-06T21:27:22Z</dc:date>
    </item>
    <item>
      <title>Re: Files Uploaded are Corrupted After api usage</title>
      <link>https://www.dropboxforum.com/t5/Discuss-Dropbox-Developer-API/Files-Uploaded-are-Corrupted-After-api-usage/m-p/401188#M1053</link>
      <description>&lt;P&gt;There's no reason an upload without extra encoding like that should result in a corrupted file.&lt;/P&gt;
&lt;P&gt;If you can reproduce an issue where correct code and a valid original file results in a corrupted file when uploaded to&amp;nbsp;Dropbox via the API, please share the steps and code to reproduce it so we can look into it.&lt;/P&gt;</description>
      <pubDate>Fri, 06 Mar 2020 21:49:50 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Discuss-Dropbox-Developer-API/Files-Uploaded-are-Corrupted-After-api-usage/m-p/401188#M1053</guid>
      <dc:creator>Greg-DB</dc:creator>
      <dc:date>2020-03-06T21:49:50Z</dc:date>
    </item>
  </channel>
</rss>

