<?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: Upload file using jquery in Discuss Dropbox Developer &amp; API</title>
    <link>https://www.dropboxforum.com/t5/Discuss-Dropbox-Developer-API/Upload-file-using-jquery/m-p/507243#M1800</link>
    <description>&lt;P&gt;From your code I see you're attempting to upload to a "&lt;A href="https://help.dropbox.com/files-folders/share/view-only-access" target="_self"&gt;shared link&lt;/A&gt;" (the "&lt;A href="https://www.dropbox.com/sh/" target="_blank"&gt;https://www.dropbox.com/sh/&lt;/A&gt;..." link). That only offers the ability to read the linked content though, not the ability to upload to it.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To programmatically upload a file, you can use the&amp;nbsp;/2/files/upload&amp;nbsp;Dropbox API endpoint. You can find information on using that in &lt;A href="https://www.dropbox.com/developers/documentation/http/documentation#files-upload" target="_self"&gt;the documentation here&lt;/A&gt;.&lt;/P&gt;</description>
    <pubDate>Tue, 23 Mar 2021 15:30:09 GMT</pubDate>
    <dc:creator>Greg-DB</dc:creator>
    <dc:date>2021-03-23T15:30:09Z</dc:date>
    <item>
      <title>Upload file using jquery</title>
      <link>https://www.dropboxforum.com/t5/Discuss-Dropbox-Developer-API/Upload-file-using-jquery/m-p/507144#M1797</link>
      <description>&lt;P&gt;I'm trying to upload an image to dropbox using jquery, but I get an error for cors policy block. Is there another way to upload?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;My code:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;var xhr = new XMLHttpRequest();&lt;/P&gt;
&lt;P&gt;xhr.upload.onprogress = function (evt) {&lt;BR /&gt;var percentComplete = parseInt(100.0 * evt.loaded / evt.total);&lt;BR /&gt;// Upload in progress. Do something here with the percent complete.&lt;BR /&gt;};&lt;/P&gt;
&lt;P&gt;xhr.onload = function () {&lt;BR /&gt;if (xhr.status === 200) {&lt;BR /&gt;var fileInfo = JSON.parse(xhr.response);&lt;BR /&gt;// Upload succeeded. Do something here with the file info.&lt;BR /&gt;}&lt;BR /&gt;else {&lt;BR /&gt;var errorMessage = xhr.response || 'Unable to upload file';&lt;BR /&gt;// Upload failed. Do something here with the error.&lt;BR /&gt;}&lt;BR /&gt;};&lt;/P&gt;
&lt;P&gt;xhr.open('POST', '&lt;A href="https://www.dropbox.com/sh/y7rp1h0cbquydix/AADnOhInfieO19mK_H3q71IJa?dl=0" target="_blank" rel="noopener"&gt;https://www.dropbox.com/sh/y7rp1h0cbquydix/AADnOhInfieO19mK_H3q71IJa?dl=0&lt;/A&gt;');&lt;BR /&gt;xhr.setRequestHeader('Authorization', 'Bearer ' + &amp;lt;ACCESS_TOKEN&amp;gt;);&lt;BR /&gt;xhr.setRequestHeader('Content-Type', 'application/octet-stream');&lt;BR /&gt;xhr.setRequestHeader('Dropbox-API-Arg', JSON.stringify({&lt;BR /&gt;path: '/' + imgPath,&lt;BR /&gt;mode: 'add',&lt;BR /&gt;autorename: true,&lt;BR /&gt;mute: false&lt;BR /&gt;}));&lt;/P&gt;
&lt;P&gt;xhr.send(imgPath);&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 23 Mar 2021 10:15:37 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Discuss-Dropbox-Developer-API/Upload-file-using-jquery/m-p/507144#M1797</guid>
      <dc:creator>HrcKuhar</dc:creator>
      <dc:date>2021-03-23T10:15:37Z</dc:date>
    </item>
    <item>
      <title>Re: Upload file using jquery</title>
      <link>https://www.dropboxforum.com/t5/Discuss-Dropbox-Developer-API/Upload-file-using-jquery/m-p/507243#M1800</link>
      <description>&lt;P&gt;From your code I see you're attempting to upload to a "&lt;A href="https://help.dropbox.com/files-folders/share/view-only-access" target="_self"&gt;shared link&lt;/A&gt;" (the "&lt;A href="https://www.dropbox.com/sh/" target="_blank"&gt;https://www.dropbox.com/sh/&lt;/A&gt;..." link). That only offers the ability to read the linked content though, not the ability to upload to it.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To programmatically upload a file, you can use the&amp;nbsp;/2/files/upload&amp;nbsp;Dropbox API endpoint. You can find information on using that in &lt;A href="https://www.dropbox.com/developers/documentation/http/documentation#files-upload" target="_self"&gt;the documentation here&lt;/A&gt;.&lt;/P&gt;</description>
      <pubDate>Tue, 23 Mar 2021 15:30:09 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Discuss-Dropbox-Developer-API/Upload-file-using-jquery/m-p/507243#M1800</guid>
      <dc:creator>Greg-DB</dc:creator>
      <dc:date>2021-03-23T15:30:09Z</dc:date>
    </item>
    <item>
      <title>Re: Upload file using jquery</title>
      <link>https://www.dropboxforum.com/t5/Discuss-Dropbox-Developer-API/Upload-file-using-jquery/m-p/509658#M1813</link>
      <description>&lt;P&gt;I'm using this code to upload file but I get an error:&lt;/P&gt;&lt;P&gt;"Value should match pattern '\\A(?:(/(.|[\\r\\n])*)|(ns:[0-9]+(/.*)?)|(id:.*))\\z' (Parameter 'path')"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;var client = new DropboxClient("&amp;lt;access_token&amp;gt;, "&amp;lt;access key&amp;gt;", "&amp;lt;secret key&amp;gt;");&lt;BR /&gt;try&lt;BR /&gt;{&lt;BR /&gt;await Upload(client, "&lt;A href="https://www.dropbox.com/sh/...dl=0/" target="_blank"&gt;https://www.dropbox.com/sh/...dl=0/&lt;/A&gt;", &amp;lt;image filename&amp;gt;, "AvatarImage"); -- this url is a link to share folder&lt;BR /&gt;}&lt;BR /&gt;catch (Exception ex)&lt;BR /&gt;{&lt;BR /&gt;var error = ex.Message + ex.Source;&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;async Task Upload(DropboxClient dbx, string folder, string file, string content)&lt;BR /&gt;{&lt;BR /&gt;using (var mem = new MemoryStream(Encoding.UTF8.GetBytes(content)))&lt;BR /&gt;{&lt;BR /&gt;await dbx.Files.UploadAsync(&lt;BR /&gt;folder + "/" + file,&lt;BR /&gt;WriteMode.Overwrite.Instance,&lt;BR /&gt;body: mem);&lt;BR /&gt;}&lt;BR /&gt;}&lt;/P&gt;</description>
      <pubDate>Thu, 01 Apr 2021 11:33:54 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Discuss-Dropbox-Developer-API/Upload-file-using-jquery/m-p/509658#M1813</guid>
      <dc:creator>HrcKuhar</dc:creator>
      <dc:date>2021-04-01T11:33:54Z</dc:date>
    </item>
    <item>
      <title>Re: Upload file using jquery</title>
      <link>https://www.dropboxforum.com/t5/Discuss-Dropbox-Developer-API/Upload-file-using-jquery/m-p/509692#M1814</link>
      <description>&lt;P&gt;In this code, you are also attempting to upload to a shared link. Shared links do not support uploads like this. This method expects the path where you want to upload the file in the connected account. The error message is indicating that the path you're supplying is not in the expected format (since it is a shared link, not a path).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I&amp;nbsp;recommend reading &lt;A href="https://developers.dropbox.com/dbx-file-access-guide" target="_self"&gt;the File Access Guide&lt;/A&gt; for information on how to interact with paths and files in the&amp;nbsp;Dropbox API.&lt;/P&gt;</description>
      <pubDate>Thu, 01 Apr 2021 14:38:39 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Discuss-Dropbox-Developer-API/Upload-file-using-jquery/m-p/509692#M1814</guid>
      <dc:creator>Greg-DB</dc:creator>
      <dc:date>2021-04-01T14:38:39Z</dc:date>
    </item>
  </channel>
</rss>

