1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
| // L'url où envoyer la requête
Uri gsaURI = new Uri(gsaFeedURL);
// Les autres noms/valeurs du formulaire html
StringDictionary dictionary = new StringDictionary();
// Le fichier : son contenu binaire, son uri, le nom du champ html
UploadSpec uploadSpecs = new UploadSpec();
uploadSpecs.Contents = bytes;
uploadSpecs.FileName = @"C:\FeedFile.xml";
uploadSpecs.FieldName = "data";
// Post the data
if ((int)HttpUpload.Upload(gsaURI, dictionary, uploadSpecs).StatusCode == 200)
{
Console.WriteLine("Successful.");
}
else
{
// GSA POST not successful
Console.WriteLine("Failure.");
} |