Converting and Saving a base64 image sent by an HTML POST

[h]Hi, we are building a web server that will handle HTML POSTS sent from IOS devices. The POST is composed string data and images sent as base64 strings. I need to convert those pictures back to jpeg files and store them into a folder. How do I save the web file I created on the server’s disk?[/h]

Thanks in advance!

Here is a sample of the POST body :[quote]{“no_du_vhicule”:“4665”,“cr”:“2016-04-29 16:56:04”,“pic_1”:"iVBORw0KGgoAAAANSUhEUgAAAyAAAAMgCAIAAABUEpE/AAAAAXNSR0IArs4c6QAA

Here is some of my code :

Dim jsonString As String = DefineEncoding(request.Entity, Encodings.UTF8)

Dim jsItem As New JSONItem


If jsItem.HasName("pic_1") Then
     Dim pic1 As New WebPicture
     pic1.Data = DecodeBase64(jsItem.Value(pic_1), Encodings.UTF8)
     pic1.MIMEType = "image/jpeg"
     pic1.Filename = pic_1.jpeg"
     pic1.Session = Nil
 // Save the file ?

I finally figured it out…

//Convertir l'image en fichier jpg Dim pic As Picture pic = Picture.FromData(DecodeBase64(jsItem.Value(picsNamesArray(i)))) //Rpertoire de sauvegarde Dim saveDir As FolderItem = App.ExecutableFile.Parent.Child("ProjetPhotos") #If DebugBuild Then saveDir = App.ExecutableFile.Parent.Parent.Child("ProjetPhotos") #Endif If Not saveDir.Exists Then saveDir.CreateAsFolder End If //Crer le nouveau fichier Dim pictureFile As New FolderItem pictureFile = saveDir.Child(picsNamesArray(i) + ".jpeg") //Sauvegarder la photo dans le nouveau fichier pic.Save(pictureFile, Picture.SaveAsJPEG)