Ejemplo n.º 1
0
 public override void Validate(SioCmsContext _context = null, IDbContextTransaction _transaction = null)
 {
     if (MediaFile?.FileStream != null)
     {
         MediaFile.Filename   = SeoHelper.GetSEOString(MediaFile.Filename) + Guid.NewGuid().ToString("N");
         MediaFile.FileFolder = CommonHelper.GetFullPath(new[] {
             //SioService.GetConfig<string>("UploadFolder"),
             SioService.GetTemplateUploadFolder(Specificulture),
             DateTime.UtcNow.ToString("yyyy-MM")
         });;
         var isSaved = FileRepository.Instance.SaveWebFile(MediaFile);
         if (isSaved)
         {
             Extension  = MediaFile.Extension;
             FileName   = MediaFile.Filename;
             FileFolder = MediaFile.FileFolder;
         }
         else
         {
             IsValid = false;
         }
     }
     FileType = FileType ?? "image";
     base.Validate(_context, _transaction);
 }