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");
 }
        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");
        }
Beispiel #3
0
        public ActionResult DeleteDirectory(string path)
        {
            //TODO:Add security checks

            var files  = new FilesRepository();
            var folder = files.GetFolderByPath(path);

            if (folder != null)
            {
                files.Delete(folder);
                return(Content(""));
            }
            throw new HttpException(404, "File Not Found");
        }
Beispiel #4
0
        public ActionResult CreateDirectory(string path, string name)
        {
            //TODO:Add security checks

            var files  = new FilesRepository();
            var folder = files.GetFolderByPath(path);

            if (folder != null)
            {
                files.CreateDirectory(folder, name);
                return(Content(""));
            }
            throw new HttpException(403, "Forbidden");
        }
Beispiel #5
0
        public ActionResult Upload(string path, HttpPostedFileBase file)
        {
            //TODO:Add security checks

            if (file != null && !string.IsNullOrEmpty(path))
            {
                var files        = new FilesRepository();
                var parentFolder = files.GetFolderByPath(path);
                if (parentFolder != null)
                {
                    files.SaveImage(parentFolder, file);
                    return(Json(new FileEntry
                    {
                        Name = Path.GetFileName(file.FileName)
                    }, "text/plain"));
                }
            }
            throw new HttpException(404, "File Not Found");
        }
 public ActionResult Upload(string path, HttpPostedFileBase file)
 {
     if (file != null)
     {
         var files        = new FilesRepository();
         var parentFolder = files.GetFolderByPath(path);
         if (parentFolder != null)
         {
             files.SaveImage(parentFolder, file);
             return(Json(
                        new FileBrowserEntry
             {
                 Name = Path.GetFileName(file.FileName),
                 Size = file.ContentLength
             }
                        , "text/plain"));
         }
     }
     throw new HttpException(404, "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");
 }
        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");
        }
        public ActionResult DeleteDirectory(string path)
        {
            //TODO:Add security checks

            var files = new FilesRepository();
            var folder = files.GetFolderByPath(path);
            if (folder != null)
            {
                files.Delete(folder);
                return Content("");
            }
            throw new HttpException(404, "File Not Found");
        }
        public ActionResult Upload(string path, HttpPostedFileBase file)
        {
            //TODO:Add security checks

            if (file != null && !string.IsNullOrEmpty(path))
            {
                var files = new FilesRepository();
                var parentFolder = files.GetFolderByPath(path);
                if (parentFolder != null)
                {
                    files.SaveImage(parentFolder, file);
                    return Json(new FileEntry
                                    {
                                        Name = Path.GetFileName(file.FileName)
                                    }, "text/plain");
                }
            }
            throw new HttpException(404, "File Not Found");
        }
        public ActionResult CreateDirectory(string path, string name)
        {
            //TODO:Add security checks

            var files = new FilesRepository();
            var folder = files.GetFolderByPath(path);
            if (folder != null)
            {
                files.CreateDirectory(folder, name);
                return Content("");
            }
            throw new HttpException(403, "Forbidden");
        }
 public ActionResult Upload(string path, HttpPostedFileBase file)
 {
     if (file != null)
     {
         var files = new FilesRepository();
         var parentFolder = files.GetFolderByPath(path);
         if (parentFolder != null)
         {
             files.SaveImage(parentFolder, file);
             return Json(
                 new FileBrowserEntry
                 {
                     Name = Path.GetFileName(file.FileName),
                     Size = file.ContentLength
                 }
             , "text/plain");
         }
     }
     throw new HttpException(404, "File Not Found");
 }