TLSharp icon indicating copy to clipboard operation
TLSharp copied to clipboard

Uploading profile photo results in PHOTO_EXT_INVALID

Open hananf1994 opened this issue 7 years ago • 6 comments

hi guys i want upload new photo for profile this my code

            TLInputFile uploadedFile = new TLInputFile();
            Task.Run(async()=> uploadedFile = (TLInputFile)await client.UploadFile("tass", new StreamReader("E:\\tass.png"))).Wait();
            var changeRequest = new TeleSharp.TL.Photos.TLRequestUploadProfilePhoto()
            {
                File= new TLInputFile() {
                    Id=uploadedFile.Id,
                    Parts=uploadedFile.Parts,
                    Name=uploadedFile.Name,
                    Md5Checksum=uploadedFile.Md5Checksum,
                },
                Dirty=true,
                Sequence=(int)uploadedFile.Id
            };
            dynamic changeResult = null;
            Task.Run(async () => changeResult = await client.SendRequestAsync<TLInputPhoto>(changeRequest)).Wait();

but return this error "PHTO_EXT_INVALID"

image

please help me

hananf1994 avatar Mar 18 '18 16:03 hananf1994

please help me guys

hananf1994 avatar Mar 19 '18 18:03 hananf1994

Try to use "jpeg" image?

vkomachenok avatar Mar 19 '18 19:03 vkomachenok

used all image extentions

hananf1994 avatar Mar 22 '18 07:03 hananf1994

you know how to change profile phtoto ??

hananf1994 avatar Mar 23 '18 12:03 hananf1994

you need to change this: Task.Run(async()=> uploadedFile = (TLInputFile)await client.UploadFile("tass", new StreamReader("E:\tass.png"))).Wait();

to this: Task.Run(async()=> uploadedFile = (TLInputFile)await client.UploadFile("tass.png", new StreamReader("E:\tass.png"))).Wait();

but I get an "InvalidCastException" error. BUT everything works. go throw that error with "try catch" and thats it

speekflayder avatar Mar 09 '20 20:03 speekflayder

add a type like photo.png to the file name

vshtykhnov avatar Aug 17 '20 08:08 vshtykhnov