public ActionResult _Upload(IEnumerable <HttpPostedFileBase> files) { if (files == null || !files.Any()) { return(Json(new { success = false, errorMessage = "No file uploaded." })); } var file = files.FirstOrDefault(); // get ONE only if (file == null || !ImageUpload.IsImage(file)) { return(Json(new { success = false, errorMessage = "File is of wrong format." })); } if (file.ContentLength <= 0) { return(Json(new { success = false, errorMessage = "File cannot be zero length." })); } var webPath = ImageUpload.GetTempSavedFilePath(file); //mistertommat - 18 Nov '15 - replacing '\' to '//' results in incorrect image url on firefox and IE, // therefore replacing '\\' to '/' so that a proper web url is returned. return(Json(new { success = true, fileName = webPath.Replace("\\", "/") })); // success }