diff --git a/ImgBBApi.cs b/ImgBBApi.cs index fbaccb7..ee8340f 100644 --- a/ImgBBApi.cs +++ b/ImgBBApi.cs @@ -29,7 +29,12 @@ namespace Iminetsoft /* SORGU GONDERDIK VE JSON RESPONSE-U ELDE ETDIK: */ string requestUrl = $"https://api.imgbb.com/1/upload?key={ApiKey}"; MultipartFormDataContent content = new MultipartFormDataContent(); - string base64OfImage = Convert.ToBase64String(File.ReadAllBytes(imagePath)); + + // Temporary solution + string base64OfImage = File.Exists(imagePath) ? Convert.ToBase64String(File.ReadAllBytes(imagePath)) + : imagePath.Trim(); + + content.Add(new StringContent(base64OfImage), "image"); content.Add(new StringContent(Path.GetFileNameWithoutExtension(imagePath)), "name"); HttpRequestMessage request = new HttpRequestMessage(HttpMethod.Post, requestUrl) { Content = content }; diff --git a/ImgBBApi.csproj b/ImgBBApi.csproj index 4cdfc20..cb04552 100644 --- a/ImgBBApi.csproj +++ b/ImgBBApi.csproj @@ -1,14 +1,15 @@  - net5.0;net6.0 - disable - Library + net5.0;net6.0;net7.0;net8.0 + disable + Library ImgBBApi ImgBBApi Added package icon - 1.0.2 - 1.0.2 - 1.0.2 + False + 1.0.3 + $(AssemblyVersion) + $(AssemblyVersion) iminet C# library for ImgBB Iminetsoft.ImgBBApi @@ -20,9 +21,8 @@ C# library for ImgBB false true - false + false -