title: Dropbox v2.0 API Uploading File
body: <p>So i need to upload a file into my dropbox account using c#</p>
  
  <p>I'm currently using Dropbox API v2.0 which is relatively new.</p>
  
  <p>I'm working with winforms c# and I was given this example code from Dropbox themselves here : <a href="https://www.dropbox.com/developers/documentation/dotnet#tutorial" rel="nofollow">https://www.dropbox.com/developers/documentation/dotnet#tutorial</a></p>
  
  <p>I need some help tho, I don't quite understand How I'd call Upload in a winforms.</p>
  
  <pre><code>    private void Form1_FormClosing(object sender, FormClosingEventArgs e)
      {
          var task = Task.Run((Func&lt;Task&gt;)this.Upload);
          task.Wait();
      }
  
      async Task Upload()
      {
          DropboxClient dbx = new DropboxClient("FF5tO7fs20AAAAAAAAALcjFNxDeEpWSneNOPl6ya9276gFB7s7pUJKVI2vAxFcSs");
          var file = "159386425737-IPs.txt";
          var mem = new MemoryStream(Encoding.UTF8.GetBytes("TESTING" + IPCount.ToString()));
          try
          {
              var updated = await dbx.Files.UploadAsync(file, WriteMode.Overwrite.Instance, body: mem);
          }
          catch (Exception e)
          {
              MessageBox.Show(e.ToString());
          }
      }
  </code></pre>
  
  <p>Error I'm getting is on this line</p>
  
  <pre><code>var updated = await.....
  </code></pre>
  
  <p>and this is the runtime error it is throwing</p>
  
  <pre><code>System.ArgumentsOutOfRangeException: Specified argument was out of range of valid values.
  Parameter name: Path
  </code></pre>
  
  <p>and this error </p>
  
  <pre><code>Dropbox.Api.BadInputException : Error in call to API function "files/upload" : HTTP header "Dropbox-Api-Arg": path: "folder//file"" did not match parretn '/.*'
  </code></pre>