Example #1
0
        public string Upload()
        {
            string FileOrignalName         = "";
            string FileGeneratedName       = "";
            string FileOrignalReturnName   = "";
            string FileGeneratedReturnName = "";
            string FilePath = "~/uploads/files/";

            for (int i = 0; i < Request.Files.Count; i++)
            {
                var file = Request.Files[i];
                FileOrignalName   = file.FileName;
                FileGeneratedName = FCommon.GenerateFileName(file.FileName);
                var path = Path.Combine(Server.MapPath(FilePath), FileGeneratedName);
                file.SaveAs(path);
                //FCommon.VaryQualityLevel(path);

                if (i > 0)
                {
                    FileOrignalReturnName   += ":" + FileOrignalName;
                    FileGeneratedReturnName += ":" + FileGeneratedName;
                }
                else
                {
                    FileOrignalReturnName   += FileOrignalName;
                    FileGeneratedReturnName += FileGeneratedName;
                }
            }
            return(JsonConvert.SerializeObject(FileOrignalReturnName + "|" + FileGeneratedReturnName));
        }