コード例 #1
0
ファイル: CustomerController.cs プロジェクト: IBIBank/IBITest
        public JsonResult UploadSalaryProof()
        {
            string imgPath = string.Empty;
            long requestID;
            CustomerDAL customerDALObj = new CustomerDAL();

            for (int i = 0; i < Request.Files.Count; i++)
            {
                HttpPostedFileBase file = Request.Files[i]; //Uploaded file
                //Use the following properties to get file's name, size and MIMEType
                int fileSize = file.ContentLength;
                string fileName = file.FileName;
                string mimeType = file.ContentType;
                System.IO.Stream fileContent = file.InputStream;
                requestID = customerDALObj.GetNextLoanAccountRequestID();
                //To save file, use SaveAs method
                imgPath = "Images/ApplyForLoan/" + "AFL_SP_" + requestID + ".jpg";
                file.SaveAs(Server.MapPath("~/") + imgPath); //File will be saved in directory
            }
            return Json("Image uploaded successfully !");
        }