Beispiel #1
0
        public InvokeResult <ClearUploadedFilesRet> ClearUploadedFiles(ClearUploadedFilesParam param)
        {
            InvokeResult <ClearUploadedFilesRet> result = new InvokeResult <ClearUploadedFilesRet>()
            {
                Success = true, ret = new ClearUploadedFilesRet()
            };
            List <string> successFilePaths = new List <string>();

            try
            {
                foreach (var filePath in param.FilePaths)
                {
                    string uploadPathDecode = HttpContext.Current.Server.UrlDecode(filePath);
                    string uploadPath       = HttpContext.Current.Server.MapPath(uploadPathDecode);
                    FileAdapter.Delete(uploadPath);
                    successFilePaths.Add(uploadPathDecode);
                }
            }
            catch (Exception ex)
            {
                result.Success      = false;
                result.ErrorMessage = ex.Message;
            }
            result.ret.SuccessFilePaths = successFilePaths;
            return(result);
        }
 public void Delete(string filePath)
 {
     FileAdapter.Delete(_defaultPath + filePath);
 }