public ActionResult SaveImage(HttpPostedFileBase file)
        {
            try
            {
                if (file.ContentLength > 0)
                {
                    string fileName = Guid.NewGuid() + "-" + System.IO.Path.GetFileName(file.FileName);
                    if (!Directory.Exists(Server.MapPath("~/Content/Upload")))
                    {
                        Directory.CreateDirectory(Server.MapPath("~/Content/Upload"));
                    }

                    string path = Path.Combine(
                        Server.MapPath("~/Content/Upload"), fileName);
                    file.SaveAs(path);
                    //return file save success info
                    Response.StatusCode = (int)HttpStatusCode.OK;


                    //OCR function
                    string ApplicationId = "Lei_test_app";
                    string Password      = "******";
                    string FilePath      = "~/Content/Upload/" + fileName;

                    OCR    oCR       = new OCR(ApplicationId, Password, FilePath);
                    string ocrResult = oCR.GetResult(FilePath, "English", "txt");

                    /*
                     * string ocrResult = "test";
                     * System.Threading.Thread.Sleep(1000);
                     */
                    return(Json(new { success = true, responseText = "Successfully extracted text from image.", ocrResult = ocrResult }, JsonRequestBehavior.AllowGet));
                }
                else
                {
                    throw new Exception("Cannot save file.");
                }
            }
            catch (Exception e)
            {
                Response.StatusCode = (int)HttpStatusCode.BadRequest;
                return(Json(new { error = -1, responseText = e.ToString() }, JsonRequestBehavior.AllowGet));
            }
        }