using System.Net; を書いておかないとダメです。
// ファイルを開く using (FileStream stream = new FileStream("C:\\test.txt", FileMode.Open, FileAccess.Read)) { // PUTでstream送信する HttpWebRequest request = (HttpWebRequest)WebRequest.Create("http://api.example.com/upload/"); request.Method = "PUT"; request.ContentType = "application/octet-stream"; request.ContentLength = stream.Length; request.AllowWriteStreamBuffering = false; // タイムアウト6h request.Timeout = 360 * 60 * 1000; request.ReadWriteTimeout = 360 * 60 * 1000; try { using (Stream requestStream = request.GetRequestStream()) { stream.CopyTo(requestStream); } } catch (Exception) { // nop } request.GetResponse(); }