Last active
August 29, 2015 14:14
-
-
Save travcunn/0db59f2a8bc831bf61b0 to your computer and use it in GitHub Desktop.
SmartFile file upload
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.IO; | |
using System.Web; | |
using System.Net; | |
using System.Collections; | |
using SmartFile; | |
namespace SmartFileTest | |
{ | |
class MainClass | |
{ | |
public static int Main (string[] args) | |
{ | |
// Setup new SmartFile client | |
BasicClient api = new BasicClient(); | |
// Data to send in POST request | |
Hashtable p = new Hashtable(); | |
p.Add("file0", new FileInfo("wallpaper.jpg")); | |
// Upload file to /windowstest/wallpaper.jpg | |
HttpWebResponse r = api.Post("path/data/windowstest", null, p); | |
// Display JSON result of SmartFile API call in the console | |
StreamReader _Answer = new StreamReader(r.GetResponseStream()); | |
Console.WriteLine(_Answer.ReadToEnd()); | |
return 0; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment