wp-net / WordPressPCL

This is a portable library for consuimg the WordPress REST-API in (almost) any C# application
MIT License
335 stars 131 forks source link

Error when uploading images #333

Open mirasolutions opened 1 year ago

mirasolutions commented 1 year ago

Hello i have this error when upload images

Error converting value "" to type 'WordPressPCL.Models.OpenStatus'. Path 'comment_status', line 1, position 465

any idea ?

ThomasPe commented 1 year ago

hey, does the image get uploaded or does this error happen before the actual upload? can you show some code?

mirasolutions commented 1 year ago

Yes, upload work but not return URL of image

private async Task carica_foto(WordPressClient wpc) { Stream s = File.OpenRead(this.path_foto); bool valid = await wpc.IsValidJWToken(); MediaItem createdMedia = null; if (valid) { createdMedia = await wpc.Media.Create(s, this.nome_foto); } return createdMedia.SourceUrl; }