background image

//////////////////////////////////////
//调用
string[] fileNames = new string[5];
            fileNames = saveFileupload();
            string proposerPic = fileNames[0];    
            string executorPic = fileNames[1];
            string improveBeforePic = fileNames[2];     
            string improveAfterPic = fileNames[3];
            string standardiFile = fileNames[4];

///////////////////////////////////////

private string[] saveFileupload()
        {
            string[] fileName = new string[5];
            HttpPostedFile postedFile = null;      
            try
            {
                for (int i = 0; i < Request.Files.Count; i++) {
                    postedFile = Request.Files[i];
                    if (postedFile.FileName != null && !"".Equals(postedFile.FileName))
                    {
                        //fileName[i] = @"Uploads/" + Path.GetFileName(postedFile.FileName);
                        //string savePath = Server.MapPath("~");
                        //savePath += fileName[i];
                        ////检查是否在服务器上已经存在用户上传的同名文件
                        //if (File.Exists(savePath))
                        //{
                        //    File.Delete(savePath);
                        //}
                        //postedFile.SaveAs(savePath);
                        int fileSize = postedFile.ContentLength / 1024;
                        fileName[i] = @"Uploads/" + Path.GetFileName(postedFile.FileName);
                        string savePath = Server.MapPath("~");
                        savePath += fileName[i];
                        if (2048 <= fileSize && (i == 2 || i == 3))
                        {
                            if (CompressImage(postedFile, savePath, 520, 700, 100))
                            {
                                //检查是否在服务器上已经存在用户上传的同名文件
                                //if (File.Exists(savePath))