Click here to Skip to main content
15,896,111 members
Please Sign up or sign in to vote.
4.50/5 (2 votes)
See more:
Please tell me how to upload pictures from c# to this site ?
Posted

 
Share this answer
 
void uploadTinyPic(string imagetags, string filename){
foxtrot.xray.WebRobot wrobot = new foxtrot.xray.WebRobot();
foxtrot.xray.Form wform;
foxtrot.xray.Input wtags;
foxtrot.xray.Input wimg;
foxtrot.xray.Input wurl;
wrobot.Base = "http://tinypic.com/";
wrobot.LoadPage("/");
wform = wrobot.Forms[0];
wtags = wform.GetFieldByName("the_tag");
wimg = wform.GetFieldByName("the_file");
wtags.InputValue = imagetags;
wimg.InputValue = filename;
wrobot.SubmitForm(wform);
wform = wrobot.Forms[0];
wtags = wform.GetFieldByName("mytag");
wimg = wform.GetFieldByName("myimg");
wurl = wform.GetFieldByName("myurl");
System.Windows.Forms.MessageBox.Show_
("Image uploaded successfully!\r\n" +
"HTML link: " + (string)wtags.InputValue + "\r\n" +
"[IMG] tag: " + (string)wimg.InputValue + "\r\n" +
"Image URL: " + (string)wurl.InputValue);
}
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900