Best practice to upload files on server using Rest Service I am using building REST services for file upload on the server. Here is some code of that

[OprationContract]
[WebInvoke(Method = "POST", UriTemplate = "UploadFile/{fileName}")]
public string UploadFile(string fileName, Stream fileStream)
{
  string filePath = serverDirectory + "\\" + fileName;
  using (var output = File.Open(filePath, FileMode.Create))
  {
     fileStream.CopyTo(output);
  }
  return "success";
}


However this method works fine when file size is small. but when the file size is large say 30-40 Mb then the performance become low. 

So I want to know what are the best practices to upload the files on the server with speed.
The lines of code inside your UploadFile method look optimal to me.

Perhaps the problem is that your Stream contents are being fully buffered before they're being delivered.

I've no experience with this myself, but
How to: Enable Streaming suggests you may need to change your configured TransferMode, and change your API so that it has a method whose only parameter is Stream (perhaps pass the filename in one method and the Stream in the next method).