Exemplo n.º 1
0
        public bool DeleteFile(string fileName)
        {
            try
            {
                //if (System.IO.File.Exists(HttpContext.Current.Server.MapPath("~" + url)))
                //    System.IO.File.Delete(HttpContext.Current.Server.MapPath("~" + url));
                string[] tmp  = fileName.Split('/');
                string   path = "";
                for (int i = 0; i < tmp.Length - 1; i++)
                {
                    if (tmp[i] != "")
                    {
                        path += tmp[i] + "/";
                    }
                }
                fileName = tmp[tmp.Length - 1];

                AmazonS3.DeleteFile(path, fileName);
                return(true);
            }
            catch (Exception ex)
            {
                return(false);
            }
        }