title: Write uploaded file to linux server from asp.net mvc 4.0 application
body: <p>I want to upload an uploaded file to both where my mvc 4.0 application runs and to another server that is powered by linux based server. I want to upload file to directory under tomcat server(ex: KGS/assets/). I can upload file to local server by the following code</p>
  
  <pre><code>public ActionResult Upload(string qqfile, int id)
          {
              //resim ekliyor
              const string path = @"C:\Temp\";
              const string kgsPath =@"\\";
              try
              {
                  var stream = Request.InputStream;
                  string file;
                  if (String.IsNullOrEmpty(Request["qqfile"]))
                  {
                      // IE
                      HttpPostedFileBase postedFile = Request.Files[0];
                      stream = postedFile.InputStream;
                      file = Path.Combine(path, System.IO.Path.GetFileName(Request.Files[0].FileName));
                  }
                  else
                  {
                      //Webkit, Mozilla
                      file = Path.Combine(path, qqfile);
                  }
  
                  var buffer = new byte[stream.Length];
                  stream.Read(buffer, 0, buffer.Length);
                  System.IO.File.WriteAllBytes(file, buffer);
  
              }
              catch (Exception ex)
              {
                  return Json(new { success = false, message = ex.Message }, "application/json");
              }
              return Json(new { success = true }, "text/html");
          }
  </code></pre>
  
  <p>Are there anyways or approaches to achieve this or is this impossible to be done?</p>