Created
March 5, 2025 05:03
-
-
Save donma/60f738552274db3b9a7f436bfaf98493 to your computer and use it in GitHub Desktop.
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
var filePath = AppDomain.CurrentDomain.BaseDirectory + "oig.jpg"; | |
//user key from https://vgy.me/account/details | |
var response=UploadImageVgyMe(filePath, "user_key"); | |
Console.WriteLine("Image path:" + response.image); | |
static VgyMeUploadImageResponse UploadImageVgyMe(string filePath, string userKey) | |
{ | |
var client = new RestClient("https://vgy.me/upload"); | |
var request = new RestRequest("", Method.Post); | |
request.AddFile("file", filePath, "image/jpeg"); // 根據實際檔案類型調整 MIME 類型 | |
request.AddParameter("userkey", userKey); | |
var response = client.Execute(request); | |
Console.WriteLine(response.Content); // 印出 API 回應 | |
return JsonConvert.DeserializeObject<VgyMeUploadImageResponse>(response.Content); | |
} | |
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
public class VgyMeUploadImageResponse | |
{ | |
public bool error { get; set; } | |
public int size { get; set; } | |
public string filename { get; set; } | |
public string ext { get; set; } | |
public string url { get; set; } | |
public string image { get; set; } | |
public string delete { get; set; } | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment