How can I use the AtTask API to Upload a File using C#












0














I am using a modified version of the C# API Example to add tasks to an existing Workfront (AtTask) Task. I would also like to upload and download file attachments.



It appears from the documentation that uploading is a two-step process, step 1 upload the file and step 2 attach the uploaded file to the task. I understand somewhat how to do the second step - post a JSON token with the file name, the handle (from the upload), object type (TASK), object ID, and currentVersion. What I don't understand is step 1, the actual uploading of the file.



I am creating a PDF file that needs to be attached to the task. Once the task is completed, a new document will be added that I need to download.



Does anyone have any C# code for performing either the upload or the download?



Here is my code so far:



public JToken DoUpload(string path, string opportunityID, string description, params string parameters)
{
List<string> list = parameters.ToList();

if (!path.StartsWith("/"))
{
path = "/" + path;
}
string fullUrl = url + path + ToQueryString(parameters);
string boundary = "------" + DateTime.Now.Ticks.ToString("x");

WebRequest request = HttpWebRequest.CreateDefault(new Uri(fullUrl));
request.ContentType = "multipart/form-data; boundary=" + boundary;
request.Method = "POST";

using (var requestStream = request.GetRequestStream())
{
using (var writer = new StreamWriter(requestStream))
{
writer.WriteLine(string.Format("Content-Disposition: form-data; name="{0}" filename="{1}"", "uploadedFile", "RFQ" + opportunityID + ".html"));
writer.WriteLine("Content-Type: text/html; charset=UTF-8");
writer.WriteLine();
writer.WriteLine(description);

using (WebResponse response = request.GetResponse())
{
using (Stream responseStream = response.GetResponseStream())
{
return ReadResponse(responseStream);
}
}
}
}
}









share|improve this question





























    0














    I am using a modified version of the C# API Example to add tasks to an existing Workfront (AtTask) Task. I would also like to upload and download file attachments.



    It appears from the documentation that uploading is a two-step process, step 1 upload the file and step 2 attach the uploaded file to the task. I understand somewhat how to do the second step - post a JSON token with the file name, the handle (from the upload), object type (TASK), object ID, and currentVersion. What I don't understand is step 1, the actual uploading of the file.



    I am creating a PDF file that needs to be attached to the task. Once the task is completed, a new document will be added that I need to download.



    Does anyone have any C# code for performing either the upload or the download?



    Here is my code so far:



    public JToken DoUpload(string path, string opportunityID, string description, params string parameters)
    {
    List<string> list = parameters.ToList();

    if (!path.StartsWith("/"))
    {
    path = "/" + path;
    }
    string fullUrl = url + path + ToQueryString(parameters);
    string boundary = "------" + DateTime.Now.Ticks.ToString("x");

    WebRequest request = HttpWebRequest.CreateDefault(new Uri(fullUrl));
    request.ContentType = "multipart/form-data; boundary=" + boundary;
    request.Method = "POST";

    using (var requestStream = request.GetRequestStream())
    {
    using (var writer = new StreamWriter(requestStream))
    {
    writer.WriteLine(string.Format("Content-Disposition: form-data; name="{0}" filename="{1}"", "uploadedFile", "RFQ" + opportunityID + ".html"));
    writer.WriteLine("Content-Type: text/html; charset=UTF-8");
    writer.WriteLine();
    writer.WriteLine(description);

    using (WebResponse response = request.GetResponse())
    {
    using (Stream responseStream = response.GetResponseStream())
    {
    return ReadResponse(responseStream);
    }
    }
    }
    }
    }









    share|improve this question



























      0












      0








      0







      I am using a modified version of the C# API Example to add tasks to an existing Workfront (AtTask) Task. I would also like to upload and download file attachments.



      It appears from the documentation that uploading is a two-step process, step 1 upload the file and step 2 attach the uploaded file to the task. I understand somewhat how to do the second step - post a JSON token with the file name, the handle (from the upload), object type (TASK), object ID, and currentVersion. What I don't understand is step 1, the actual uploading of the file.



      I am creating a PDF file that needs to be attached to the task. Once the task is completed, a new document will be added that I need to download.



      Does anyone have any C# code for performing either the upload or the download?



      Here is my code so far:



      public JToken DoUpload(string path, string opportunityID, string description, params string parameters)
      {
      List<string> list = parameters.ToList();

      if (!path.StartsWith("/"))
      {
      path = "/" + path;
      }
      string fullUrl = url + path + ToQueryString(parameters);
      string boundary = "------" + DateTime.Now.Ticks.ToString("x");

      WebRequest request = HttpWebRequest.CreateDefault(new Uri(fullUrl));
      request.ContentType = "multipart/form-data; boundary=" + boundary;
      request.Method = "POST";

      using (var requestStream = request.GetRequestStream())
      {
      using (var writer = new StreamWriter(requestStream))
      {
      writer.WriteLine(string.Format("Content-Disposition: form-data; name="{0}" filename="{1}"", "uploadedFile", "RFQ" + opportunityID + ".html"));
      writer.WriteLine("Content-Type: text/html; charset=UTF-8");
      writer.WriteLine();
      writer.WriteLine(description);

      using (WebResponse response = request.GetResponse())
      {
      using (Stream responseStream = response.GetResponseStream())
      {
      return ReadResponse(responseStream);
      }
      }
      }
      }
      }









      share|improve this question















      I am using a modified version of the C# API Example to add tasks to an existing Workfront (AtTask) Task. I would also like to upload and download file attachments.



      It appears from the documentation that uploading is a two-step process, step 1 upload the file and step 2 attach the uploaded file to the task. I understand somewhat how to do the second step - post a JSON token with the file name, the handle (from the upload), object type (TASK), object ID, and currentVersion. What I don't understand is step 1, the actual uploading of the file.



      I am creating a PDF file that needs to be attached to the task. Once the task is completed, a new document will be added that I need to download.



      Does anyone have any C# code for performing either the upload or the download?



      Here is my code so far:



      public JToken DoUpload(string path, string opportunityID, string description, params string parameters)
      {
      List<string> list = parameters.ToList();

      if (!path.StartsWith("/"))
      {
      path = "/" + path;
      }
      string fullUrl = url + path + ToQueryString(parameters);
      string boundary = "------" + DateTime.Now.Ticks.ToString("x");

      WebRequest request = HttpWebRequest.CreateDefault(new Uri(fullUrl));
      request.ContentType = "multipart/form-data; boundary=" + boundary;
      request.Method = "POST";

      using (var requestStream = request.GetRequestStream())
      {
      using (var writer = new StreamWriter(requestStream))
      {
      writer.WriteLine(string.Format("Content-Disposition: form-data; name="{0}" filename="{1}"", "uploadedFile", "RFQ" + opportunityID + ".html"));
      writer.WriteLine("Content-Type: text/html; charset=UTF-8");
      writer.WriteLine();
      writer.WriteLine(description);

      using (WebResponse response = request.GetResponse())
      {
      using (Stream responseStream = response.GetResponseStream())
      {
      return ReadResponse(responseStream);
      }
      }
      }
      }
      }






      c# api upload attask






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Mar 3 '15 at 22:41

























      asked Feb 25 '15 at 19:06









      wframsay

      11




      11
























          2 Answers
          2






          active

          oldest

          votes


















          0














          The first step is to get a handel, that is done just like any other api call you do to POST /attask/api/upload, this is where you include the file, it will be uploaded to a temp folder at Workfront(AtTask), Workfront will return the handel, then you do a second step to update the task incldue the handel and the file will be posted to it.



          For more reference check out https://developers.attask.com/api-docs/ and https://developers.attask.com/api-docs/code-samples/






          share|improve this answer





















          • Thanks, Jim. I have read all the documentation, unfortunately the documentation regarding uploading files is very sparse, i.e, "Do a POST/attask/api/upload" - with no details on how to actually perform the upload. I have written some code, but have been successful only in generating 400 errors.
            – wframsay
            Mar 3 '15 at 22:37



















          0














          public static string HttpUploadFile(string url, string filename, byte file, string paramName, string contentType, NameValueCollection nvc)
          {
          string boundary = "---------------------------" + DateTime.Now.Ticks.ToString("x");
          byte boundarybytes = System.Text.Encoding.ASCII.GetBytes("rn--" + boundary + "rn");

          HttpWebRequest wr = (HttpWebRequest)WebRequest.Create(url);
          wr.ContentType = "multipart/form-data; boundary=" + boundary;
          wr.Method = "POST";
          wr.KeepAlive = true;
          wr.Credentials = System.Net.CredentialCache.DefaultCredentials;

          Stream rs = wr.GetRequestStream();

          string formdataTemplate = "Content-Disposition: form-data; name="{0}"rnrn{1}";
          foreach (string key in nvc.Keys)
          {
          rs.Write(boundarybytes, 0, boundarybytes.Length);
          string formitem = string.Format(formdataTemplate, key, nvc[key]);
          byte formitembytes = System.Text.Encoding.UTF8.GetBytes(formitem);
          rs.Write(formitembytes, 0, formitembytes.Length);
          }
          rs.Write(boundarybytes, 0, boundarybytes.Length);

          string headerTemplate = "Content-Disposition: form-data; name="{0}"; filename="{1}"rnContent-Type: {2}rnrn";
          string header = string.Format(headerTemplate, paramName, filename, contentType);
          byte headerbytes = System.Text.Encoding.UTF8.GetBytes(header);
          rs.Write(headerbytes, 0, headerbytes.Length);

          rs.Write(file, 0, file.Length);

          byte trailer = System.Text.Encoding.ASCII.GetBytes("rn--" + boundary + "--rn");
          rs.Write(trailer, 0, trailer.Length);
          rs.Close();

          WebResponse wresp = null;
          string ret = null;
          try
          {
          wresp = wr.GetResponse();
          Stream stream2 = wresp.GetResponseStream();
          StreamReader reader2 = new StreamReader(stream2);

          ret = reader2.ReadToEnd();
          }
          catch (Exception ex)
          {
          if (wresp != null)
          {
          wresp.Close();
          wresp = null;
          }
          }
          finally
          {
          wr = null;
          }

          return ret;
          }


           



          JToken ret = HttpUploadFile("/upload", file_name, file_bytes, "uploadedFile", "", new NameValueCollection());





          share|improve this answer























            Your Answer






            StackExchange.ifUsing("editor", function () {
            StackExchange.using("externalEditor", function () {
            StackExchange.using("snippets", function () {
            StackExchange.snippets.init();
            });
            });
            }, "code-snippets");

            StackExchange.ready(function() {
            var channelOptions = {
            tags: "".split(" "),
            id: "1"
            };
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function() {
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled) {
            StackExchange.using("snippets", function() {
            createEditor();
            });
            }
            else {
            createEditor();
            }
            });

            function createEditor() {
            StackExchange.prepareEditor({
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader: {
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            },
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            });


            }
            });














            draft saved

            draft discarded


















            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f28727542%2fhow-can-i-use-the-attask-api-to-upload-a-file-using-c-sharp%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            2 Answers
            2






            active

            oldest

            votes








            2 Answers
            2






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            0














            The first step is to get a handel, that is done just like any other api call you do to POST /attask/api/upload, this is where you include the file, it will be uploaded to a temp folder at Workfront(AtTask), Workfront will return the handel, then you do a second step to update the task incldue the handel and the file will be posted to it.



            For more reference check out https://developers.attask.com/api-docs/ and https://developers.attask.com/api-docs/code-samples/






            share|improve this answer





















            • Thanks, Jim. I have read all the documentation, unfortunately the documentation regarding uploading files is very sparse, i.e, "Do a POST/attask/api/upload" - with no details on how to actually perform the upload. I have written some code, but have been successful only in generating 400 errors.
              – wframsay
              Mar 3 '15 at 22:37
















            0














            The first step is to get a handel, that is done just like any other api call you do to POST /attask/api/upload, this is where you include the file, it will be uploaded to a temp folder at Workfront(AtTask), Workfront will return the handel, then you do a second step to update the task incldue the handel and the file will be posted to it.



            For more reference check out https://developers.attask.com/api-docs/ and https://developers.attask.com/api-docs/code-samples/






            share|improve this answer





















            • Thanks, Jim. I have read all the documentation, unfortunately the documentation regarding uploading files is very sparse, i.e, "Do a POST/attask/api/upload" - with no details on how to actually perform the upload. I have written some code, but have been successful only in generating 400 errors.
              – wframsay
              Mar 3 '15 at 22:37














            0












            0








            0






            The first step is to get a handel, that is done just like any other api call you do to POST /attask/api/upload, this is where you include the file, it will be uploaded to a temp folder at Workfront(AtTask), Workfront will return the handel, then you do a second step to update the task incldue the handel and the file will be posted to it.



            For more reference check out https://developers.attask.com/api-docs/ and https://developers.attask.com/api-docs/code-samples/






            share|improve this answer












            The first step is to get a handel, that is done just like any other api call you do to POST /attask/api/upload, this is where you include the file, it will be uploaded to a temp folder at Workfront(AtTask), Workfront will return the handel, then you do a second step to update the task incldue the handel and the file will be posted to it.



            For more reference check out https://developers.attask.com/api-docs/ and https://developers.attask.com/api-docs/code-samples/







            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered Mar 3 '15 at 21:08









            Jim Young

            1592




            1592












            • Thanks, Jim. I have read all the documentation, unfortunately the documentation regarding uploading files is very sparse, i.e, "Do a POST/attask/api/upload" - with no details on how to actually perform the upload. I have written some code, but have been successful only in generating 400 errors.
              – wframsay
              Mar 3 '15 at 22:37


















            • Thanks, Jim. I have read all the documentation, unfortunately the documentation regarding uploading files is very sparse, i.e, "Do a POST/attask/api/upload" - with no details on how to actually perform the upload. I have written some code, but have been successful only in generating 400 errors.
              – wframsay
              Mar 3 '15 at 22:37
















            Thanks, Jim. I have read all the documentation, unfortunately the documentation regarding uploading files is very sparse, i.e, "Do a POST/attask/api/upload" - with no details on how to actually perform the upload. I have written some code, but have been successful only in generating 400 errors.
            – wframsay
            Mar 3 '15 at 22:37




            Thanks, Jim. I have read all the documentation, unfortunately the documentation regarding uploading files is very sparse, i.e, "Do a POST/attask/api/upload" - with no details on how to actually perform the upload. I have written some code, but have been successful only in generating 400 errors.
            – wframsay
            Mar 3 '15 at 22:37













            0














            public static string HttpUploadFile(string url, string filename, byte file, string paramName, string contentType, NameValueCollection nvc)
            {
            string boundary = "---------------------------" + DateTime.Now.Ticks.ToString("x");
            byte boundarybytes = System.Text.Encoding.ASCII.GetBytes("rn--" + boundary + "rn");

            HttpWebRequest wr = (HttpWebRequest)WebRequest.Create(url);
            wr.ContentType = "multipart/form-data; boundary=" + boundary;
            wr.Method = "POST";
            wr.KeepAlive = true;
            wr.Credentials = System.Net.CredentialCache.DefaultCredentials;

            Stream rs = wr.GetRequestStream();

            string formdataTemplate = "Content-Disposition: form-data; name="{0}"rnrn{1}";
            foreach (string key in nvc.Keys)
            {
            rs.Write(boundarybytes, 0, boundarybytes.Length);
            string formitem = string.Format(formdataTemplate, key, nvc[key]);
            byte formitembytes = System.Text.Encoding.UTF8.GetBytes(formitem);
            rs.Write(formitembytes, 0, formitembytes.Length);
            }
            rs.Write(boundarybytes, 0, boundarybytes.Length);

            string headerTemplate = "Content-Disposition: form-data; name="{0}"; filename="{1}"rnContent-Type: {2}rnrn";
            string header = string.Format(headerTemplate, paramName, filename, contentType);
            byte headerbytes = System.Text.Encoding.UTF8.GetBytes(header);
            rs.Write(headerbytes, 0, headerbytes.Length);

            rs.Write(file, 0, file.Length);

            byte trailer = System.Text.Encoding.ASCII.GetBytes("rn--" + boundary + "--rn");
            rs.Write(trailer, 0, trailer.Length);
            rs.Close();

            WebResponse wresp = null;
            string ret = null;
            try
            {
            wresp = wr.GetResponse();
            Stream stream2 = wresp.GetResponseStream();
            StreamReader reader2 = new StreamReader(stream2);

            ret = reader2.ReadToEnd();
            }
            catch (Exception ex)
            {
            if (wresp != null)
            {
            wresp.Close();
            wresp = null;
            }
            }
            finally
            {
            wr = null;
            }

            return ret;
            }


             



            JToken ret = HttpUploadFile("/upload", file_name, file_bytes, "uploadedFile", "", new NameValueCollection());





            share|improve this answer




























              0














              public static string HttpUploadFile(string url, string filename, byte file, string paramName, string contentType, NameValueCollection nvc)
              {
              string boundary = "---------------------------" + DateTime.Now.Ticks.ToString("x");
              byte boundarybytes = System.Text.Encoding.ASCII.GetBytes("rn--" + boundary + "rn");

              HttpWebRequest wr = (HttpWebRequest)WebRequest.Create(url);
              wr.ContentType = "multipart/form-data; boundary=" + boundary;
              wr.Method = "POST";
              wr.KeepAlive = true;
              wr.Credentials = System.Net.CredentialCache.DefaultCredentials;

              Stream rs = wr.GetRequestStream();

              string formdataTemplate = "Content-Disposition: form-data; name="{0}"rnrn{1}";
              foreach (string key in nvc.Keys)
              {
              rs.Write(boundarybytes, 0, boundarybytes.Length);
              string formitem = string.Format(formdataTemplate, key, nvc[key]);
              byte formitembytes = System.Text.Encoding.UTF8.GetBytes(formitem);
              rs.Write(formitembytes, 0, formitembytes.Length);
              }
              rs.Write(boundarybytes, 0, boundarybytes.Length);

              string headerTemplate = "Content-Disposition: form-data; name="{0}"; filename="{1}"rnContent-Type: {2}rnrn";
              string header = string.Format(headerTemplate, paramName, filename, contentType);
              byte headerbytes = System.Text.Encoding.UTF8.GetBytes(header);
              rs.Write(headerbytes, 0, headerbytes.Length);

              rs.Write(file, 0, file.Length);

              byte trailer = System.Text.Encoding.ASCII.GetBytes("rn--" + boundary + "--rn");
              rs.Write(trailer, 0, trailer.Length);
              rs.Close();

              WebResponse wresp = null;
              string ret = null;
              try
              {
              wresp = wr.GetResponse();
              Stream stream2 = wresp.GetResponseStream();
              StreamReader reader2 = new StreamReader(stream2);

              ret = reader2.ReadToEnd();
              }
              catch (Exception ex)
              {
              if (wresp != null)
              {
              wresp.Close();
              wresp = null;
              }
              }
              finally
              {
              wr = null;
              }

              return ret;
              }


               



              JToken ret = HttpUploadFile("/upload", file_name, file_bytes, "uploadedFile", "", new NameValueCollection());





              share|improve this answer


























                0












                0








                0






                public static string HttpUploadFile(string url, string filename, byte file, string paramName, string contentType, NameValueCollection nvc)
                {
                string boundary = "---------------------------" + DateTime.Now.Ticks.ToString("x");
                byte boundarybytes = System.Text.Encoding.ASCII.GetBytes("rn--" + boundary + "rn");

                HttpWebRequest wr = (HttpWebRequest)WebRequest.Create(url);
                wr.ContentType = "multipart/form-data; boundary=" + boundary;
                wr.Method = "POST";
                wr.KeepAlive = true;
                wr.Credentials = System.Net.CredentialCache.DefaultCredentials;

                Stream rs = wr.GetRequestStream();

                string formdataTemplate = "Content-Disposition: form-data; name="{0}"rnrn{1}";
                foreach (string key in nvc.Keys)
                {
                rs.Write(boundarybytes, 0, boundarybytes.Length);
                string formitem = string.Format(formdataTemplate, key, nvc[key]);
                byte formitembytes = System.Text.Encoding.UTF8.GetBytes(formitem);
                rs.Write(formitembytes, 0, formitembytes.Length);
                }
                rs.Write(boundarybytes, 0, boundarybytes.Length);

                string headerTemplate = "Content-Disposition: form-data; name="{0}"; filename="{1}"rnContent-Type: {2}rnrn";
                string header = string.Format(headerTemplate, paramName, filename, contentType);
                byte headerbytes = System.Text.Encoding.UTF8.GetBytes(header);
                rs.Write(headerbytes, 0, headerbytes.Length);

                rs.Write(file, 0, file.Length);

                byte trailer = System.Text.Encoding.ASCII.GetBytes("rn--" + boundary + "--rn");
                rs.Write(trailer, 0, trailer.Length);
                rs.Close();

                WebResponse wresp = null;
                string ret = null;
                try
                {
                wresp = wr.GetResponse();
                Stream stream2 = wresp.GetResponseStream();
                StreamReader reader2 = new StreamReader(stream2);

                ret = reader2.ReadToEnd();
                }
                catch (Exception ex)
                {
                if (wresp != null)
                {
                wresp.Close();
                wresp = null;
                }
                }
                finally
                {
                wr = null;
                }

                return ret;
                }


                 



                JToken ret = HttpUploadFile("/upload", file_name, file_bytes, "uploadedFile", "", new NameValueCollection());





                share|improve this answer














                public static string HttpUploadFile(string url, string filename, byte file, string paramName, string contentType, NameValueCollection nvc)
                {
                string boundary = "---------------------------" + DateTime.Now.Ticks.ToString("x");
                byte boundarybytes = System.Text.Encoding.ASCII.GetBytes("rn--" + boundary + "rn");

                HttpWebRequest wr = (HttpWebRequest)WebRequest.Create(url);
                wr.ContentType = "multipart/form-data; boundary=" + boundary;
                wr.Method = "POST";
                wr.KeepAlive = true;
                wr.Credentials = System.Net.CredentialCache.DefaultCredentials;

                Stream rs = wr.GetRequestStream();

                string formdataTemplate = "Content-Disposition: form-data; name="{0}"rnrn{1}";
                foreach (string key in nvc.Keys)
                {
                rs.Write(boundarybytes, 0, boundarybytes.Length);
                string formitem = string.Format(formdataTemplate, key, nvc[key]);
                byte formitembytes = System.Text.Encoding.UTF8.GetBytes(formitem);
                rs.Write(formitembytes, 0, formitembytes.Length);
                }
                rs.Write(boundarybytes, 0, boundarybytes.Length);

                string headerTemplate = "Content-Disposition: form-data; name="{0}"; filename="{1}"rnContent-Type: {2}rnrn";
                string header = string.Format(headerTemplate, paramName, filename, contentType);
                byte headerbytes = System.Text.Encoding.UTF8.GetBytes(header);
                rs.Write(headerbytes, 0, headerbytes.Length);

                rs.Write(file, 0, file.Length);

                byte trailer = System.Text.Encoding.ASCII.GetBytes("rn--" + boundary + "--rn");
                rs.Write(trailer, 0, trailer.Length);
                rs.Close();

                WebResponse wresp = null;
                string ret = null;
                try
                {
                wresp = wr.GetResponse();
                Stream stream2 = wresp.GetResponseStream();
                StreamReader reader2 = new StreamReader(stream2);

                ret = reader2.ReadToEnd();
                }
                catch (Exception ex)
                {
                if (wresp != null)
                {
                wresp.Close();
                wresp = null;
                }
                }
                finally
                {
                wr = null;
                }

                return ret;
                }


                 



                JToken ret = HttpUploadFile("/upload", file_name, file_bytes, "uploadedFile", "", new NameValueCollection());






                share|improve this answer














                share|improve this answer



                share|improve this answer








                edited Nov 19 '18 at 15:16









                pushkin

                3,949112651




                3,949112651










                answered Nov 19 '18 at 14:50









                Anatoliy Zingerov

                1




                1






























                    draft saved

                    draft discarded




















































                    Thanks for contributing an answer to Stack Overflow!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid



                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.


                    To learn more, see our tips on writing great answers.





                    Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


                    Please pay close attention to the following guidance:


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid



                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.


                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function () {
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f28727542%2fhow-can-i-use-the-attask-api-to-upload-a-file-using-c-sharp%23new-answer', 'question_page');
                    }
                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    android studio warns about leanback feature tag usage required on manifest while using Unity exported app?

                    SQL update select statement

                    'app-layout' is not a known element: how to share Component with different Modules