C#将文件上传到file.io并获取下载链接 [英] C# Upload File to file.io and Get Download Link

查看:100
本文介绍了C#将文件上传到file.io并获取下载链接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在编写程序,而我要尝试做的一件事情就是能够让我的程序从其资源中获取文件并将其上传到

I've been making a program and one of the things I'm trying to do is be able to have my program take a file from its' resources and upload it to file.io. file.io is a simple file uploading website with a simple API, I'm just not sure how to use that API in my program. Once the file has been uploaded, I want to be able to get the link from the website. It's fairly simple but I'm unsure how to mimic the action of clicking the upload button and choosing my file, then grabbing the link. I know there's many posts all around about uploading files but honestly they confuse me and don't really relate to this situation. If someone knows a post that is similar to my issue and can help me, or can help me in any way I'd appreciate it a lot. If you need any details let me know.

推荐答案

在这里,他们的api非常简单:

Here ya go, their api is pretty straightforward:

    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"];
    }

这篇关于C#将文件上传到file.io并获取下载链接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆