Exemplo n.º 1
0
        public ActionResult Upload()
        {
            var path = Request.Form["path"] ?? string.Empty;

            path = DiskStorage.FileManagerCleanPath(path);

            try
            {
                for (var i = 0; i < Request.Files.Count; i++)
                {
                    var file = Request.Files[i];
                    if (file.ContentLength > 0)
                    {
                        var completeFileName = file.FileName;
                        var nameSmall        = Path.GetFileName(completeFileName);
                        var fullPathAndName  = path + "\\" + nameSmall;
                        DiskStorage.FileManagerCreateFile(HccApp.CurrentStore.Id, fullPathAndName, file);
                    }
                }
            }
            catch (Exception ex)
            {
                FlashFailure(ex.Message);
                EventLog.LogEvent(ex);
            }

            var destination = Url.Content("~/DesktopModules/Hotcakes/API/mvc/filemanager?path=" + path);

            return(new RedirectResult(destination));
        }
Exemplo n.º 2
0
        public ActionResult Upload()
        {
            string path = Request.Form["path"] ?? string.Empty;

            path = DiskStorage.FileManagerCleanPath(path);

            try
            {
                for (int i = 0; i < Request.Files.Count; i++)
                {
                    HttpPostedFileBase file = Request.Files[i];
                    if (file.ContentLength > 0)
                    {
                        string completeFileName = file.FileName;
                        string nameSmall        = System.IO.Path.GetFileName(completeFileName);
                        string fullPathAndName  = path + "\\" + nameSmall;
                        DiskStorage.FileManagerCreateFile(MTApp.CurrentStore.Id, fullPathAndName, file);
                    }
                }
            }
            catch (Exception ex)
            {
                FlashFailure(ex.Message);
                MerchantTribe.Commerce.EventLog.LogEvent(ex);
            }

            string destination = Url.Content("~/bvadmin/content/filemanager?path=" + path);

            return(new RedirectResult(destination));
        }