Open edmilsonlani opened 1 year ago
The following snippet worked for me:
var fs = File.Open("PNG_Test.png", FileMode.Open);
var media = await client.Media.CreateAsync(fs, "PNG_Test.png");
The file is visible in the media library and has the correct size.
This returns a 403
I'm testing the library and I managed to create a post correctly, but when I try to create a media, it doesn't work correctly.
It uploads the image to the folder correctly, but it has a different size and a non-image format.
I tested a few methods and they all worked the same way.
if (await client.Auth.IsValidJWTokenAsync())
{
//Stream s = new FileStream(@"C:\Temp\erro_tela.png", FileMode.Open, FileAccess.Read, FileShare.Read);
Stream s = File.OpenRead(@"C:\Temp\erro_tela.png");
var createdMedia = await client.Media.CreateAsync(s, "erro_tela.png");
//var createdMedia = await client.Media.CreateAsync(@"C:\Temp\erro_tela.png", "erro_tela.png");
Console.WriteLine(createdMedia.MimeType);
Console.WriteLine(createdMedia.SourceUrl);
}