Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

upload file wcf [duplicate]

Tags:

c#

.net

wcf

upload

I'll create an WCF for uploading file such as images or pdf files to te server. How can I create a service that can handle this function ? I tried to googling about it, but most of article told me to use Stream as service parameter. But what I want is using byte[] (array) for the file content. because, this service is not only accessing using .nte framework, but also using other technologies, such as php, java, objective-c, etc.

any helps ?

like image 201
Ichiro Satoshi Avatar asked Oct 18 '11 08:10

Ichiro Satoshi


2 Answers

Seems streaming is your only option. See this [MSDN example]

See this question : How to upload a file to a WCF Service?

You could check out this article: http://blogs.msdn.com/b/carlosfigueira/archive/2008/04/17/wcf-raw-programming-model-receiving-arbitrary-data.aspx

It talks about just setup WCF Service for receiving arbitrary data, and you can POST from any client (php,java etc)

like image 199
gideon Avatar answered Sep 25 '22 08:09

gideon


Create a WCF service method accepting byte[] as a parameter:

[OperationContract]
public void ReceiveByteArray(byte[] byteArray) { ... }
like image 44
Karel Frajták Avatar answered Sep 23 '22 08:09

Karel Frajták