Created
December 26, 2018 15:56
-
-
Save isdaviddong/e1d1545128d94fb9e617d775588ea03c to your computer and use it in GitHub Desktop.
上傳檔案到 建立Imgur
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //建立ImgurClient(其中的"CLIENT_ID", "CLIENT_SECRET"要換成你自己的) | |
| var client = new ImgurClient(CLIENT_ID, CLIENT_SECRET); | |
| var endpoint = new ImageEndpoint(client); | |
| IImage image; | |
| //取得圖片檔案FileStream | |
| using (var fs = new FileStream(FilePath, FileMode.Open)) | |
| { | |
| image = endpoint.UploadImageStreamAsync(fs).GetAwaiter().GetResult(); | |
| } | |
| //顯示圖檔位置 | |
| Response.Write("Image uploaded. Image Url: " + image.Link); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment