c# - Upload document to Server using HttpPost -


the application "a" requires upload word-file [as byte array] external application using post.

the filecontent should added named parameter in request body , have make post request upload file.

i have sample code, in java. write equivalent c# code. in c#, not find similar object multipartentity.

java code snippet:

string resturl = hosturl + "/rest/upload/0b002f4780293c18";         string filename = "testrestuploadbyfolderid" + calendar.getinstance().gettimeinmillis() + ".txt";         file testfile = createnewfile("c:/temp/rest/" + filename);         filebody content = new filebody(testfile, "application/octet-stream");         system.out.println(" file name : " + content.getfilename() + " ... "                +     content.gettransferencoding());         multipartentity reqentity = new multipartentity(httpmultipartmode.browser_compatible);         reqentity.addpart("filename", new stringbody(filename));         reqentity.addpart("uploadfile", content);         httppost httppost = new httppost(resturl);         httppost.addheader("accept", "application/json");         httppost.setentity(reqentity);                   // post request         string response = httpclient.execute(httppost, new defaultresponsehandler()); 

could please post links explains how make named parameter in c# upload filecontent

thank you.

go below link.it may you

http://www.tangiblesoftwaresolutions.com/product_details/java_to_csharp_converter.html?gclid=cj-vu9if46wcfuoa6wodvw-coa

or can take java language conversion assistant(jlca) go through link http://support.microsoft.com/kb/819018


Comments

Popular posts from this blog

jquery - How can I dynamically add a browser tab? -

node.js - Getting the socket id,user id pair of a logged in user(s) -

keyboard - C++ GetAsyncKeyState alternative -