public ActionResult AzureUpload(string path, IList <HttpPostedFileBase> uploadFiles, string action, FileManagerDirectoryContent args)
        {
            if (path == null)
            {
                return(Content(""));
            }
            if (args.Path != "")
            {
                string startPath    = "<--blobPath-->";
                string originalPath = ("<--filePath-->").Replace(startPath, "");
                args.Path = (originalPath + args.Path).Replace("//", "/");
            }
            FileManagerResponse uploadResponse;

            uploadResponse = operation.Upload(args.Path, args.UploadFiles, args.Action, args.Data);
            if (uploadResponse.Error != null)
            {
                HttpResponse Response = System.Web.HttpContext.Current.Response;
                Response.Clear();
                Response.Status            = uploadResponse.Error.Code + " " + uploadResponse.Error.Message;
                Response.StatusCode        = Int32.Parse(uploadResponse.Error.Code);
                Response.StatusDescription = uploadResponse.Error.Message;
                Response.End();
            }
            return(Json(""));
        }
Example #2
0
        public ActionResult AzureUpload(FileManagerDirectoryContent args)
        {
            if (args.Path != "")
            {
                string startPath    = "<--blobPath-->";
                string originalPath = ("<--filePath-->").Replace(startPath, "");
                args.Path = (originalPath + args.Path).Replace("//", "/");
                //----------------------
                //For example
                //string startPath = "https://azure_service_account.blob.core.windows.net/files/";
                //string originalPath = ("https://azure_service_account.blob.core.windows.net/files/Files").Replace(startPath, "");
                //args.Path = (originalPath + args.Path).Replace("//", "/");
                //----------------------
            }
            FileManagerResponse uploadResponse = operation.Upload(args.Path, args.UploadFiles, args.Action, args.Data);

            if (uploadResponse.Error != null)
            {
                Response.Clear();
                Response.ContentType = "application/json; charset=utf-8";
                Response.StatusCode  = Convert.ToInt32(uploadResponse.Error.Code);
                Response.HttpContext.Features.Get <IHttpResponseFeature>().ReasonPhrase = uploadResponse.Error.Message;
            }
            return(Json(""));
        }
Example #3
0
 public ActionResult AzureUpload(FileManagerDirectoryContent args)
 {
     if (args.Path != "")
     {
         string startPath    = _blobPath;
         string originalPath = _filePath.Replace(startPath, "");
         args.Path = (originalPath + args.Path).Replace("//", "/");
     }
     _operation.Upload(args.Path, args.UploadFiles, args.Action, args.Data);
     return(Json(""));
 }
Example #4
0
 public ActionResult AzureUpload(FileManagerDirectoryContent args)
 {
     if (args.Path != "")
     {
         string originalPath = "https://ej2filemanager.blob.core.windows.net/files/Files/";
         string startPath    = "https://ej2filemanager.blob.core.windows.net/files/";
         originalPath = originalPath.Replace(startPath, "");
         args.Path    = (originalPath + args.Path).Replace("//", "/");
     }
     operation.Upload(args.Path, args.UploadFiles, args.Action, args.Data);
     return(Json(""));
 }
        public ActionResult AzureUpload(FileManagerDirectoryContent args, [FromRoute] string newroot)
        {
            if (args.Path != "")
            {
                originalPath = originalPath.Replace(startPath, "");
                args.Path    = (originalPath + args.Path).Replace("//", "/");

                if (newroot != null)
                {
                    string destFolder = args.Path.Replace(baseFolder, "").Replace("/", "");
                    args.Path       = (baseFolder + "/" + newroot + "/" + destFolder + "/").Replace("//", "/");
                    args.TargetPath = (baseFolder + "/" + newroot + "/" + destFolder).Replace("//", "/");
                }
            }
            operation.Upload(args.Path, args.UploadFiles, args.Action, args.Data);
            return(Json(""));
        }
        public ActionResult AzureUpload(FileManagerDirectoryParams args)
        {
            if (args.Path != "")
            {
                string startPath    = "<--blobPath-->";
                string originalPath = ("<--filePath-->").Replace(startPath, "");
                args.Path = (originalPath + args.Path).Replace("//", "/");
                //----------------------
                //for example
                //string startPath = "https://azure_service_account.blob.core.windows.net/files/";
                //string originalPath = ("https://azure_service_account.blob.core.windows.net/files/Files").Replace(startPath, "");
                //args.Path = (originalPath + args.Path).Replace("//", "/");
                //----------------------
            }

            operation.Upload(args.Path, args.UploadFiles, args.Action, args.Data);
            return(Json(""));
        }