c# - Converting stream to base 64 -
i working xamarin forms , received image in stream. now, need convert base64 send webservice how can ?
i trying:
protected async task pickimage() { try { stream stream = await dependencyservice.get<ipicturepicker>().getimagestreamasync(); //stream.gettype<uri>(); if (stream != null) { image image = new image { source = imagesource.fromstream(() => stream), backgroundcolor = color.gray }; cadastrar_foto_perfil.source = imagesource.fromstream(() => stream); byte[] imagedata = new byte[stream.length]; stream.read(imagedata, 0, system.convert.toint32(stream.length)); string _base64string = convert.tobase64string(imagedata); user.cont_imagem = _base64string; } if (device.os == targetplatform.ios) { loginpage.recriacadastroios(); } }
but @ first line error:
specified method not supported.
thanks help
wiki
Comments
Post a Comment