<p>I've build a WCF Service to accept a file and write it to disk. The front-end consists of a page with SWFUpload which is handling the upload on the client side. Apparently, SWFUpload posts the data with a Content Type of: multipart/form-data.</p>

<p>I would think this ok but on the Service side I get an error. The error is "ProtocolException" expecting text/xml. I've tried different message encodings in the bindings but nothing seems to work.</p>

<p>How can I get this file uploaded using multipart/form-data? </p>

[{'answer_id': 51259, 'author': 'JasonS', 'author_id': 1865, 'author_profile': 'https://Stackoverflow.com/users/1865', 'pm_score': 0, 'selected': False, 'text': '<p>I believe you are going to have to tranfer the file as a byte array to WCF.  You will need to handle the post from SWFUpload and convert to a byte array before sending to your service.</p>\n'}, {'answer_id': 51260, 'author': 'aku', 'author_id': 1196, 'author_profile': 'https://Stackoverflow.com/users/1196', 'pm_score': 4, 'selected': True, 'text': '<p>@jdiaz,</p>\n\n<p>@JasonS is right, to upload file you need to transfer it as a byte stream. You need to use <a href="http://msdn2.microsoft.com/en-us/library/ms733742.aspx" rel="noreferrer">WCF streaming</a>. For example on how to upload file via WCF see <a href="http://kjellsj.blogspot.com/2007/02/wcf-streaming-upload-files-over-http.html" rel="noreferrer">an article</a> from <a href="http://kjellsj.blogspot.com" rel="noreferrer">http://kjellsj.blogspot.com</a></p>\n'}, {'answer_id': 51272, 'author': 'Philippe', 'author_id': 920, 'author_profile': 'https://Stackoverflow.com/users/920', 'pm_score': 2, 'selected': False, 'text': '<p>What you want to use is probably <a href="http://www.w3.org/TR/soap12-mtom/" rel="nofollow noreferrer">MTOM</a>, if you want it to be standard. Using this, you can have MIME multiparts messages.</p>\n\n<p>You then have to read the file as a stream and stuff it into one of the parameters of the request.</p>\n'}, {'answer_id': 5799593, 'author': 'majed', 'author_id': 726553, 'author_profile': 'https://Stackoverflow.com/users/726553', 'pm_score': 1, 'selected': False, 'text': '<p>It might be that your WCF service targets .NET Framework 3.5 and your IIS is running on .NET Framework 4.0. In this case (framework mismatch) you need to modify your service.</p>\n'}]
['https://Stackoverflow.com/questions/51256', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/831/']