title: How display a json error message?
body: <p>I cannot display the Json message, Im trying prevente that user upload files with same name this is my controller code:</p>
  
  <pre><code>     //POST: /Quote/Create   Save the Uploaded file
      public ActionResult SaveUploadedFile(int? chunk, string name)
      {
          bool exists;
          var fileUpload = Request.Files[0];
          var uploadPath = "C:\\Files";        
          chunk = chunk ?? 0;
          if (System.IO.File.Exists(Path.Combine(uploadPath, name)))
          {
              exists = true;
          }
          else {
              exists = false;
          }
          if (!exists)
          {
              using (var fs = new FileStream(Path.Combine(uploadPath, name), chunk == 0 ? FileMode.Create : FileMode.Append))
              {
                  var buffer = new byte[fileUpload.InputStream.Length];
                  fileUpload.InputStream.Read(buffer, 0, buffer.Length);
  
                  fs.Write(buffer, 0, buffer.Length);
              }
              return Json(new { success = true }, JsonRequestBehavior.AllowGet);
          }
          else {
              return Json(new { success = false, Message = "The file" + name +"already exists" }, JsonRequestBehavior.AllowGet);
  
          }
      }
  </code></pre>
  
  <p>This is my view code, if files success is false, then display the Json message:</p>
  
  <pre><code>            UploadComplete: function (up, files) {
              if (!files.success) {
  
                  alert(files.Message);
                  console.log(up);
              } else {
                  var j = 0;
                  if (count &gt; 0) {
                      j = count;
                  } else {
                      j = @i + '';
                  }
                  $.each(files, function (i, file) {
  
                      var extension = file.name.split(".");
  
                      $('.files').append('&lt;input type=\"hidden\" name=\"Files[' + j + '].Name\" value=\"' + file.name + '\" /&gt;');
                      $('.files').append('&lt;input type=\"hidden\" name=\"Files[' + j + '].Date\" value=\"' + "@DateTime.Now" + '\" /&gt;');
                      j++;
                  });
              }
          }
  </code></pre>
  
  <p>Thanks in advance !!</p>