ramtinak / InstagramApiSharp

A complete Private Instagram API for .NET (C#, VB.NET).
MIT License
780 stars 239 forks source link

handle is missing #612

Open ponmetkilastu opened 3 months ago

ponmetkilastu commented 3 months ago

### Important note

I've:

Issue category

Language

Usage

Operating System

Debug logs

If your issue has an debug log, post it here, unless remove this section!

Describe your issue

Please type your issue here.

Screenshots

If you have screenshots, you can post it here. unless remove this section!

I get the error "Handle is missing" when uploading photos. what is the solution?

public async Task UploadPhotoAsync() { string photoPath = @"C:\Users\users\Desktop\asdas\1.jpeg";

var api = await LoadSessionData("session.dat", "username", "password");

if (api == null || !api.IsUserAuthenticated)
{
    throw new Exception("auth errorr");
}

if (!File.Exists(photoPath))
{
    throw new FileNotFoundException($"The photo file at {photoPath} does not exist.");
}

var mediaImage = new InstaImageUpload
{
    Height = 360,
    Width = 360,
    Uri = photoPath
};

var result =  await api.MediaProcessor.UploadPhotoAsync(mediaImage, "good");

if (result.Succeeded)
{
    richTextBox1.AppendText("success");
}
else
{
    richTextBox1.ScrollToCaret();
    richTextBox1.AppendText($"Failed to upload photo: {result.Info.Message}");
    richTextBox1.ScrollToCaret();
}

} output Ş Failed to upload photo: message: "Handle is missing."