c# - Uploading image to server and reading the response -
i have posted image file server having php file.
i used following code :
void photochoosertask_completed(object sender, photoresult e) { if (e.taskresult == taskresult.ok) { byte[] sbytedata = readtoend(e.chosenphoto); string s = sbytedata.tostring(); webclient wc = new webclient(); uri u = new uri("http://example.com/file.php"); wc.openwritecompleted+=new openwritecompletedeventhandler(wc_openwritecompleted); wc.openwriteasync(u, "post", sbytedata); } } public static void wc_openwritecompleted(object sender, openwritecompletedeventargs e) { if (e.error == null) { object[] objarr = e.userstate object[]; byte[] filecontent = e.userstate byte[]; stream outputstream = e.result; outputstream.write(filecontent, 0, filecontent.length); outputstream.flush(); outputstream.close(); string s = e.result.tostring(); } }
but how read response server returns image file , how display image ?
Comments
Post a Comment