Beispiel #1
0
        public string UploadReference()
        {
            //string foreRef = Request["foreRef"].ToString();
            ProjectContext pc = new ProjectContext();
            string         fullPath;
            //if (foreRef != "") {
            //    string g = foreRef;
            //    fullPath = pc.GetForeReference(g);
            //    System.IO.File.Delete(fullPath);
            //}
            string path = Server.MapPath("/CompanyFiles/Reference");

            if (!Directory.Exists(path))
            {
                Directory.CreateDirectory(path);
            }
            var    curFile = Request.Files[0];
            string guid    = Guid.NewGuid().ToString();
            var    fileExt = Path.GetExtension(curFile.FileName);

            fullPath = path + "/" + guid + fileExt;
            curFile.SaveAs(fullPath);
            //临时存推荐书
            pc.AddProjectFile("0", "1", fullPath, curFile.FileName, "");
            return(guid + "|" + curFile.FileName);
        }
Beispiel #2
0
        public string FileUpload()
        {
            string pid     = Request["pid"].ToString();
            string ftype   = Request["ftype"].ToString();
            string comment = Request["comment"] ?? "";
            string path    = Server.MapPath("/projectFiles/p" + pid);

            if (!Directory.Exists(path))
            {
                Directory.CreateDirectory(path);
            }
            var    curFile  = Request.Files[0];
            var    fileExt  = Path.GetExtension(curFile.FileName);
            string guid     = Guid.NewGuid().ToString();
            string fullPath = path + "/" + guid + fileExt;

            curFile.SaveAs(fullPath);
            ProjectContext pc = new ProjectContext();

            //fullPath = "../projectFiles/p" + pid + "/" + guid + fileExt;
            pc.AddProjectFile(pid, ftype, fullPath, curFile.FileName, comment);
            return(guid + "|" + curFile.FileName);
        }