Esempio n. 1
0
 public bool UploadPic(HttpPostedFileBase file, string userid, string caption)
 {
     try {
         string path = "Not Found"; string filetype;
         if (file.ContentType.Contains("image"))
         {
             path     = CloudinaryUploads.UploadPicture(file);
             filetype = "Image";
         }
         else
         {
             path     = CloudinaryUploads.UploadVideo(file);
             filetype = "Video";
         }
         if (path != "Not Found")
         {
             bool result = photoRepository.UploadPic(path, userid, caption, filetype);
             if (result)
             {
                 return(true);
             }
         }
     }
     catch (Exception e) { }
     return(false);
 }
Esempio n. 2
0
 public bool UploadPic(HttpPostedFileBase profilePic, string userid)
 {
     try
     {
         string path = CloudinaryUploads.UploadPicture(profilePic);
         if (path != "Not Found")
         {
             string result = userDetails.UploadPic(path, userid);
             if (result != "false" && (result.IndexOf("defaultuser") == -1))
             {
                 CloudinaryUploads.DeletePreviousProfilePic(result);
             }
             return(true);
         }
     }
     catch (Exception ex) { }
     return(false);
 }