1 year ago

#366889

test-img

NoobCoder31

C# How to upload any file to a fileuploader?

I need upload my file to "https://file.io" and i tried this:

   `private void buttonInput_Click(object sender, EventArgs e)
    {
        using (WebClient client = new WebClient())
        {
            var resStr = client.UploadFile("https://file.io", @"C:\data\test.txt");
            var jObjResult = JObject.Parse(Encoding.UTF8.GetString(resStr));
            var linkToFile = jObjResult["link"];
        }
    }`

It does upload target txt file to url.

But im taking that error:

Severity Code Description Project File Line Hide Status Error CS01 'JObject' scope valid03

enter image description here

How to Fix it?

Btw im using them:

using System;
using System.Net;
using System.Text;
using System.Collections.Generic;

c#

webclient

system.net

0 Answers

Your Answer

Accepted video resources