Esempio n. 1
0
 public void PerformJSONPAction()
 {
     if (HttpContext.Current.Request.Files.Count > 0)
     {
         FileExplorerOperations.Upload(HttpContext.Current.Request.Files, HttpContext.Current.Request.QueryString.GetValues("Path")[0]);
     }
 }
Esempio n. 2
0
 public HttpResponseMessage Upload()
 {
     FileExplorerOperations.Upload(HttpContext.Current.Request.Files, HttpContext.Current.Request.QueryString.GetValues("Path")[0]);
     return(new HttpResponseMessage()
     {
         Content = new StringContent("ok", Encoding.UTF8, "text/plain")
     });
 }
Esempio n. 3
0
        public void Upload(HttpFileCollection files, string path)
        {
            FileAccessRules PathPermission = GetPathPermission(path);

            if (!PathPermission.Read || !PathPermission.Upload)
            {
                throw new ArgumentNullException("'" + path + "' is not accessible. Access is denied.");
            }
            FileExplorerOperations.Upload(files, path);
        }
Esempio n. 4
0
        public object doJSONAction()
        {
            FileExplorerParams args = FileExplorerOperations.GetAjaxData(Request);

            if (args.ActionType == "Upload")
            {
                FileExplorerOperations.Upload(args.Files, args.Path);
                return(new HttpResponseMessage()
                {
                    Content = new StringContent("ok", Encoding.UTF8, "text/plain")
                });
            }
            try
            {
                if (args.ActionType != "Paste" && args.ActionType != "GetDetails")
                {
                    var FilePath = FileExplorerOperations.ToPhysicalPath(FileExplorerOperations.ToAbsolute(args.Path));
                }
                FileOperationController Rule      = new FileOperationController();
                FileAccessOperations    operation = new FileAccessOperations(Rule.GetRules());
                switch (args.ActionType)
                {
                case "Read":
                    return(operation.ReadData(args.Path, args.ExtensionsAllow));

                case "Search":
                    return(operation.Search(args.Path, args.ExtensionsAllow, args.SearchString, args.CaseSensitive));

                case "CreateFolder":
                    return(operation.NewFolder(args.Path, args.Name));

                case "Paste":
                    return(operation.Paste(args.LocationFrom, args.LocationTo, args.Names, args.Action, args.CommonFiles));

                case "Remove":
                    return(operation.Remove(args.Names, args.Path));

                case "Rename":
                    return(operation.Rename(args.Path, args.Name, args.NewName, args.CommonFiles));

                case "GetDetails":
                    return(operation.GetDetails(args.Path, args.Names));
                }
                return("");
            }
            catch (Exception e) {
                FileExplorerResponse Response = new FileExplorerResponse();
                Response.error = e.GetType().FullName + ", " + e.Message;
                return(Response);
            }
        }