예제 #1
0
 public JsonResult CreateNewFolder(string path, String foldername)
 {
     string decodedPath = DecodePath(path);
     String folderPath = Path.Combine(decodedPath, foldername);
     if (folderPath != "\\")
         if (!Directory.Exists(folderPath))
         {
             DocumentsOperations documentsOperations = new DocumentsOperations();
             string virtualPath = UtilityOperations.GetVirtualPath(folderPath);
             documentsOperations.InsertFile(foldername, virtualPath, "", "");
             Directory.CreateDirectory(folderPath);
         }
         else
             folderPath = "";
     return new JsonResult() { Data = decodedPath };
 }
예제 #2
0
        public ActionResult Upload(string path, FormCollection collection)
        {
            if (string.IsNullOrEmpty(path) || path == "/") path = UtilityOperations.GetOOTSRootPath(Server);
            string niceName = collection["txtNiceName"];
            string description = collection["txtDescription"];
            foreach (string inputTagName in Request.Files)
            {
                HttpPostedFileBase file = Request.Files[inputTagName];
                if (file.ContentLength > 0)
                {
                    string filePath = Path.Combine(path
                        , Path.GetFileName(file.FileName));
                    DocumentsOperations documentsOperations = new DocumentsOperations();
                    string virtualPath = UtilityOperations.GetVirtualPath(filePath);
                    documentsOperations.InsertFile(file.FileName, virtualPath, niceName, description);
                    file.SaveAs(filePath);
                    return RedirectToAction("Repository", "Repository");
                }
            }

            return View();
        }