本文介绍了使用最新的API上传到imgur?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨.
需要一些快速帮助.

我正在创建一个应用程序,允许用户在该应用程序中创建图像,我想最后将其上传并给他们一个链接.我希望上传是匿名且快速的,没有用户的任何输入,而无需勾选上传" 是否.

hi guys. 
need some quick help.

I'm creating an application that lets users create an image in the application, and I want to upload it at the end and give them a link. i want the upload to be anonymous and quick, without any input from the user beyond checking off "upload" or not.

这是我在api 2中找到的代码,我尽力为api 3对其进行了修改,但仍未得到授权...

this is the code I found for api 2, and I tried my best to modify it for api 3, but still getting unauthorized...

using (var w = new WebClient())
{
var values = new NameValueCollection
{
{"Authorization", "Client-ID xxxxxxxxxxx"},
{ "image", Convert.ToBase64String(File.ReadAllBytes(xOut))}};

byte[] response = w.UploadValues("https://api.imgur.com/3/upload.xml", values);

....rest of code here
}

这段代码应该可以在api 2上很好地工作,我删除了'key'条目,添加了授权,其中xxxxxxxxxxx是我今天注册后的客户ID.

知道为什么它会不断返回未授权状态吗?

this bit of code supposedly worked well with api 2, I removed the 'key' entry, added the authorization, where xxxxxxxxxxx is my client ID after i registered today.

any idea why it keeps returning unauthorized?

在我处理此问题时,我可能可以稍后再弄清楚(但是直到遇到上述问题,我才能尝试),但是如何解析链接到新上传图像的链接?回来吗?

while i'm at it, I can probably figure this out later (but can't try until I get past the above issue), but how can I parse the link to the newly uploaded image from the return?

谢谢你.

推荐答案

谢谢.


这篇关于使用最新的API上传到imgur?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-20 08:47