c# - WCF Rest API to Upload Images -
i trying implement wcf rest service method upload images/ files mobile. primary requirement method should able related information (id & etc) image uploading.
i found below example url. https://github.com/danialfarid/ng-file-upload/tree/master/demo/c%23
could me convert below method wcf rest service post method
public void processrequest(httpcontext context) { if (context.request.files.count > 0) { httpfilecollection files = context.request.files; var username = context.request.form["name"]; (int = 0; < files.count; i++) { httppostedfile file = files[i]; string fname = context.server.mappath("uploads\\" + username.toupper() + "\\" + file.filename); file.saveas(fname); } } context.response.contenttype = "text/plain"; context.response.write("file/s uploaded successfully!"); }
expected method signature:
[operationcontract] [webinvoke(method = "post", responseformat = webmessageformat.json, uritemplate = "/uploadpictures/{id}")] bool uploadpictures(string id);
Comments
Post a Comment