Add using C#

From @jonmyates on Fri Sep 09 2016 13:02:56 GMT+0000 (UTC)

Hello,

Would anyone please be able to advise how to add a file using C#?

I have the Get working:

var myRequest = WebRequest.CreateHttp("http://127.0.0.1:5001/api/v0/object/get?arg=QmNkxQz8JzmK6Y2VUdJ8K8gVx2jrhhzLc7ESsfjnKw8coK");
            myRequest.Method = "GET";
            myRequest.UserAgent = "WebRequestDemo";

            using (var theResponse = myRequest.GetResponse())
            {
                var dataStream = theResponse.GetResponseStream();
                StreamReader reader = new StreamReader(dataStream);
                object objResponse = reader.ReadToEnd();
                dataStream.Close();
                theResponse.Close();
            }

But can’t seem to workout the Add.

Thank you.

J


Copied from original issue: https://github.com/ipfs/faq/issues/178

From @RichardLitt on Sat Sep 10 2016 03:10:00 GMT+0000 (UTC)

I’m not sure. This may belong in ipfs/support.

From @richardschneider on Wed Dec 14 2016 23:41:50 GMT+0000 (UTC)

You must POST a multipart/form-data to the IPFS server.

Here’s an example using HttpClient. Feel free to either copy the code or use the Ipfs.Api.