uikolas

Upload to server

Oct 4th, 2014
316
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.65 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Net; // butinas
  6.  
  7. namespace uploadImagesC
  8. {
  9.     class Program
  10.     {
  11.  
  12.  
  13.         static void Main(string[] args)
  14.         {
  15.             WebClient client = new WebClient();
  16.             string fileName = @"D:\Downloads\spektras.m";
  17.             ///
  18.             client.Headers.Add("Content-Type","binary/octet-stream");
  19.             byte[] result = client.UploadFile("http://url/upload.php", "POST", fileName);
  20.             String s = System.Text.Encoding.UTF8.GetString(result, 0, result.Length);
  21.             Console.WriteLine(s);
  22.         }
  23.     }
  24. }
Advertisement
Add Comment
Please, Sign In to add comment