Exemplo n.º 1
0
 /// <summary>
 /// This file create the file using base 64 string
 /// </summary> 
 /// <param name="gItem"></param>
 /// <returns></returns>
 private bool CreateFileFromBase64String(GalleryItem gItem)
 {
     try
     {
         // Get the document path and creating directory
         var galleryLocation = ConfigurationManager.AppSettings["appDocPath"] + "\\gallery\\";
         if (!Directory.Exists(galleryLocation))
             Directory.CreateDirectory(galleryLocation);
         galleryLocation = galleryLocation + gItem.FileName;
         //check for same file
         galleryLocation = new Documents().GetFileName(galleryLocation);
         gItem.FileName = Path.GetFileName(galleryLocation);
         File.WriteAllBytes(galleryLocation, Convert.FromBase64String(gItem.Base64));
     }
     catch (Exception)
     {
         return false;
     }
     return true;
 }
Exemplo n.º 2
0
 /// <summary>
 /// This function adds the file to the gallery for the client
 /// </summary>
 /// <param name="gItem"></param>
 /// <returns></returns>
 public bool AddImageToGallery(GalleryItem gItem)
 {
     return CreateFileFromBase64String(gItem);
 }