1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
|
//récupération des data de l'image dans un Bitmap
Bitmap bitmap = (Bitmap)data.Extras.Get("data");
//Chemin pour enregistrer l'image en local
String directory = System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal);
string localFilename ="MonImage.Jpeg";
string localPath = System.IO.Path.Combine(directory, localFilename);
//Création du fichier avec le contenu
using (var os = new FileStream(localPath, FileMode.Create))
{
bitmap.Compress(Bitmap.CompressFormat.Jpeg, 100, os);
}
//Affichage de l'image dans un imageView
imageView1.SetImageBitmap(bitmap);
//envoi du fichier sur le serveur
var webClient = new WebClient();
var uri = new Uri("http://192.168.1.104/index.php");
btnEnvoyer.Click += delegate
{
webClient.UploadFileAsync(uri, localPath);
}; |
Partager