problems with http file upload to wcf-rest service -
i upload file using form this:
<form action="http://127.0.0.1:8090/myservice/" method="post" enctype="multipart/form-data"> <p>select file<br> <input name="datei" type="file" size="50"> <input type="submit" value="submit"> </p> </form>
and have wcf service this:
[servicecontract] public interface idocumentconverter { [operationcontract, webinvoke(uritemplate = "/", method = "post")] void uploadfile(stream filecontents); }
i have 2 problems this. when write stream file not contain file data http stuff. seems odd. there nice way raw file data?:
-----------------------------67832811011758 content-disposition: form-data; name="datei"; filename="haha.jpg" content-type: image/jpeg ÿØÿà...
the original file looks this:
ÿØÿà...
secondly have filename in wcf. ideally this:
[servicecontract] public interface idocumentconverter { [operationcontract, webinvoke(uritemplate = "/{filename}", method = "post")] void uploadfile(string filename, stream filecontents); }
but not working, because don't know how integrate filename url using form/input stuff.
Comments
Post a Comment