<?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 It's possible to upload from javascript using URL instead of Blob/object? in Dropbox API Support &amp; Feedback</title>
    <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/It-s-possible-to-upload-from-javascript-using-URL-instead-of/m-p/346730#M19973</link>
    <description>&lt;P&gt;Hello, I'm trying to upload a file to my Dropbox account through javascript.&lt;/P&gt;&lt;P&gt;Actually, I've been using this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;    var dbx = new Dropbox.Dropbox({ accessToken: ''+data.dropbox_key+'', fetch: fetch });
    dbx.filesUpload({path: ''+data.dropbox_path+'' + data.file.name, contents: file})  &lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;the file blob/object was getting it from the input file&lt;/P&gt;&lt;P&gt;But actually I'm building another way to upload files and in this way, I don't have an input to get the file/object but the URL.&lt;/P&gt;&lt;P&gt;So my idea was something similar to this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;    var file = "&lt;A href="https://www.imperva.com/blog/wp-content/uploads/sites/9/2018/04/B64-8.png" target="_blank" rel="noopener"&gt;https://www.imperva.com/blog/wp-content/uploads/sites/9/2018/04/B64-8.png&lt;/A&gt;";&lt;BR /&gt;    var dbx = new Dropbox.Dropbox({ accessToken: ''+data.dropbox_key+'', fetch: fetch });
    dbx.filesUpload({path: ''+data.dropbox_path+'' + data.file.name, contents: file})  &lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But it uploads the file corrupted, so any way to upload using Javascript but using a URL as the source of the file?&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;</description>
    <pubDate>Wed, 29 May 2019 09:06:13 GMT</pubDate>
    <dc:creator>Yaykyo</dc:creator>
    <dc:date>2019-05-29T09:06:13Z</dc:date>
    <item>
      <title>It's possible to upload from javascript using URL instead of Blob/object?</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/It-s-possible-to-upload-from-javascript-using-URL-instead-of/m-p/346730#M19973</link>
      <description>&lt;P&gt;Hello, I'm trying to upload a file to my Dropbox account through javascript.&lt;/P&gt;&lt;P&gt;Actually, I've been using this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;    var dbx = new Dropbox.Dropbox({ accessToken: ''+data.dropbox_key+'', fetch: fetch });
    dbx.filesUpload({path: ''+data.dropbox_path+'' + data.file.name, contents: file})  &lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;the file blob/object was getting it from the input file&lt;/P&gt;&lt;P&gt;But actually I'm building another way to upload files and in this way, I don't have an input to get the file/object but the URL.&lt;/P&gt;&lt;P&gt;So my idea was something similar to this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;    var file = "&lt;A href="https://www.imperva.com/blog/wp-content/uploads/sites/9/2018/04/B64-8.png" target="_blank" rel="noopener"&gt;https://www.imperva.com/blog/wp-content/uploads/sites/9/2018/04/B64-8.png&lt;/A&gt;";&lt;BR /&gt;    var dbx = new Dropbox.Dropbox({ accessToken: ''+data.dropbox_key+'', fetch: fetch });
    dbx.filesUpload({path: ''+data.dropbox_path+'' + data.file.name, contents: file})  &lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But it uploads the file corrupted, so any way to upload using Javascript but using a URL as the source of the file?&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Wed, 29 May 2019 09:06:13 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/It-s-possible-to-upload-from-javascript-using-URL-instead-of/m-p/346730#M19973</guid>
      <dc:creator>Yaykyo</dc:creator>
      <dc:date>2019-05-29T09:06:13Z</dc:date>
    </item>
    <item>
      <title>Re: It's possible to upload from javascript using URL instead of Blob/object?</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/It-s-possible-to-upload-from-javascript-using-URL-instead-of/m-p/346809#M19983</link>
      <description>&lt;P&gt;The Dropbox API&amp;nbsp;&lt;EM&gt;does&lt;/EM&gt; have an endpoint that will save files from a URL. In the JavaScript SDK, you want the &lt;A href="http://dropbox.github.io/dropbox-sdk-js/Dropbox.html#filesSaveUrl__anchor" target="_self"&gt;filesSaveUrl()&lt;/A&gt; method, which accepts two parameters: a link to the file you want to save and a path for where you want the file saved in Dropbox.&lt;/P&gt;
&lt;P&gt;I have some other comments regarding your code. No offense intended. My goal is to educate rather than criticize.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;1. Compare your first use case to the second. In the first, you're uploading a file (literal bytes of data) to an endpoint. In the second, you're simply declaring a string as a variable (in this case, a URL) and passing it to the same endpoint. The endpoint doesn't behave the same because it's receiving totally different object types as a parameter. Does that make sense?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;2. In your second code sample, you're creating a variable named `file` and setting it to a string that is a URL. However, you're trying to access that value by referencing `data.file.name`, but that object doesn't exist (at least in the code you shared). You'll need to update that section of code to pass back a correctly formatted path to the file.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;3. As a general tip, a deep fundamental understanding the different types of objects in JavaScript can make a huge difference when interacting with public APIs.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best of luck!&lt;/P&gt;</description>
      <pubDate>Tue, 28 May 2019 20:52:25 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/It-s-possible-to-upload-from-javascript-using-URL-instead-of/m-p/346809#M19983</guid>
      <dc:creator>TaylorKrusen</dc:creator>
      <dc:date>2019-05-28T20:52:25Z</dc:date>
    </item>
  </channel>
</rss>

