Пример #1
0
        public virtual ActionResult Create(string path, ImageBrowserEntry entry)
        {
            path = NormalizePath(path);
            var name = entry.Name;

            if (name.HasValue() && AuthorizeCreateDirectory(path, name))
            {
                var physicalPath = Path.Combine(Server.MapPath(path), name);

                if (!Directory.Exists(physicalPath))
                {
                    Directory.CreateDirectory(physicalPath);
                }

                return(Json(entry));
            }

            throw new HttpException(403, "Forbidden");
        }
Пример #2
0
        public virtual ActionResult Destroy(string path, ImageBrowserEntry entry)
        {
            path = NormalizePath(path);

            if (entry != null)
            {
                path = pathProvider.CombinePaths(path, entry.Name);
                if (entry.EntryType == ImageBrowserEntryType.File)
                {
                    DeleteFile(path);
                }
                else
                {
                    DeleteDirectory(path);
                }

                return(Json(null));
            }
            throw new HttpException(404, "File Not Found");
        }
Пример #3
0
        public virtual ActionResult Destroy(string path, ImageBrowserEntry entry)
        {
            path = NormalizePath(path);

            if (entry != null)
            {
                path = pathProvider.CombinePaths(path, entry.Name);
                if (entry.EntryType == ImageBrowserEntryType.File)
                {
                    DeleteFile(path);
                }
                else
                {
                    DeleteDirectory(path);
                }

                return Json(null);
            }
            throw new HttpException(404, "File Not Found");
        }
Пример #4
0
        public virtual ActionResult Create(string path, ImageBrowserEntry entry)
        {
            path = NormalizePath(path);
            var name = entry.Name;

            if (name.HasValue() && AuthorizeCreateDirectory(path, name))
            {
                var physicalPath = Path.Combine(Server.MapPath(path), name);

                if (!Directory.Exists(physicalPath))
                {
                    Directory.CreateDirectory(physicalPath);
                }

                return Json(entry);
            }

            throw new HttpException(403, "Forbidden");
        }