public ActionResult Create(string path, FileBrowserEntry entry)
        {
            var files  = new FilesRepository();
            var folder = files.GetFolderByPath(path);

            if (folder != null)
            {
                files.CreateDirectory(folder, entry.Name);
                return(Json(new object[0]));
            }
            throw new HttpException(403, "Forbidden");
        }
Example #2
0
        public virtual ActionResult Create(string path, FileBrowserEntry entry)
        {
            path = NormalizePath(path);
            var name = entry.Name;

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

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

                return(Json(null));
            }

            throw new HttpException(403, "Forbidden");
        }
Example #3
0
        public virtual ActionResult Create(string path, FileBrowserEntry entry)
        {
            var fullPath = NormalizePath(path);
            var name     = entry.Name;

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

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

                return(Json(entry));
            }

            throw new Exception("Forbidden");
        }
Example #4
0
        public virtual ActionResult Upload(string path, IFormFile file)
        {
            var fullPath = NormalizePath(path);

            if (AuthorizeUpload(fullPath, file))
            {
                SaveFile(file, fullPath);

                var result = new FileBrowserEntry
                {
                    Size = file.Length,
                    Name = GetFileName(file)
                };

                return(Json(result));
            }

            throw new Exception("Forbidden");
        }
Example #5
0
        public virtual ActionResult Destroy(string path, FileBrowserEntry entry)
        {
            var fullPath = NormalizePath(path);

            if (entry != null)
            {
                fullPath = Path.Combine(fullPath, entry.Name);

                if (entry.EntryType == FileBrowserEntryType.File)
                {
                    DeleteFile(fullPath);
                }
                else
                {
                    DeleteDirectory(fullPath);
                }

                return(Json(new object[0]));
            }

            throw new Exception("File Not Found");
        }
        public ActionResult Destroy(string path, FileBrowserEntry entry)
        {
            var files = new FilesRepository();

            if (entry.EntryType == FileBrowserEntryType.File)
            {
                var image = files.ImageByPath(Path.Combine(path, entry.Name));
                if (image != null)
                {
                    files.Delete(image);
                    return(Json(new object[0]));
                }
            }
            else
            {
                var folder = files.GetFolderByPath(Path.Combine(path, entry.Name));
                if (folder != null)
                {
                    files.Delete(folder);
                    return(Json(new object[0]));
                }
            }
            throw new HttpException(404, "File Not Found");
        }
Example #7
0
 public override ActionResult Destroy(string path, FileBrowserEntry entry)
 {
     return(storageService.StorageOperation(() => base.Destroy(path, entry)));
 }
Example #8
0
        public virtual ActionResult CreateThumb(string path, FileBrowserEntry entry)
        {
            return(View());

            return(CreateThumbnail(path));
        }