michielpost.nl

Uploading a file with Windows 8 WinRT

16-07-2012

There are multiple ways of uploading a file over Http in Windows 8 WinRT / Metro apps.

There's a great HttpClient sample provided in the Official Windows SDK Sample Pack:
http://code.msdn.microsoft.com/windowsapps/HttpClient-sample-55700664

Sample 5 shows a basic scenario where you only want to upload file data. But what if you want to mix file data and form/text values?

Scenario 6 is really powerful. It uses the MultipartFormDataContent class to create a request like a form's POST request.
MultipartFormDataContent form = new MultipartFormDataContent();

You can add multiple types of content to this "form". For example a simple string:
form.Add(new StringContent("mystring"), "formkey");

If we want to simulate a POST request that submits a form with both text values and a file, we can also add file data (as byte array):
var fileContent = new System.Net.Http.ByteArrayContent(bytes);
form.Add(fileContent, "file");

Optionally you can add extra headers:
fileContent.Headers.ContentDisposition = new System.Net.Http.Headers.ContentDispositionHeaderValue("form-data");
fileContent.Headers.ContentDisposition.FileName = "filename";

Comments


???????? ?? ? ????, ????? ???????? ??????, ? ? ????, ????? ???? ????? ????? ?????. https://helloworld.com?h=bba4fefa5b6bd941414fa5269c7a72a1& 19-11-2020
???????? ?? ? ????, ????? ???????? ??????, ? ? ????, ????? ???? ????? ????? ?????. https://helloworld.com?h=bba4fefa5b6bd941414fa5269c7a72a1&


???????? ?? ? ????, ????? ???????? ??????, ? ? ????, ????? ???? ????? ????? ?????. http://bit.do/fLc9r?h=bba4fefa5b6bd941414fa5269c7a72a1& 19-11-2020
???????? ?? ? ????, ????? ???????? ??????, ? ? ????, ????? ???? ????? ????? ?????. http://bit.do/fLc9r?h=bba4fefa5b6bd941414fa5269c7a72a1&


???????? ?? ? ????, ????? ???????? ??????, ? ? ????, ????? ???? ????? ????? ?????. https://helloworld.com?h=bba4fefa5b6bd941414fa5269c7a72a1& 19-11-2020
???????? ?? ? ????, ????? ???????? ??????, ? ? ????, ????? ???? ????? ????? ?????. https://helloworld.com?h=bba4fefa5b6bd941414fa5269c7a72a1&


???????? ?? ? ????, ????? ???????? ??????, ? ? ????, ????? ???? ????? ????? ?????. http://bit.do/fLc9r?h=bba4fefa5b6bd941414fa5269c7a72a1& 20-11-2020
???????? ?? ? ????, ????? ???????? ??????, ? ? ????, ????? ???? ????? ????? ?????. http://bit.do/fLc9r?h=bba4fefa5b6bd941414fa5269c7a72a1&


???????? ?? ? ????, ????? ???????? ??????, ? ? ????, ????? ???? ????? ????? ?????. http://bit.do/fLc9r?h=bba4fefa5b6bd941414fa5269c7a72a1& 20-11-2020
???????? ?? ? ????, ????? ???????? ??????, ? ? ????, ????? ???? ????? ????? ?????. http://bit.do/fLc9r?h=bba4fefa5b6bd941414fa5269c7a72a1&


???????? ?? ? ????, ????? ???????? ??????, ? ? ????, ????? ???? ????? ????? ?????. http://bit.do/fLc9r?h=bba4fefa5b6bd941414fa5269c7a72a1& 21-11-2020
???????? ?? ? ????, ????? ???????? ??????, ? ? ????, ????? ???? ????? ????? ?????. http://bit.do/fLc9r?h=bba4fefa5b6bd941414fa5269c7a72a1&


???????? ?? ? ????, ????? ???????? ??????, ? ? ????, ????? ???? ????? ????? ?????. https://helloworld.com?h=bba4fefa5b6bd941414fa5269c7a72a1& 04-12-2020
???????? ?? ? ????, ????? ???????? ??????, ? ? ????, ????? ???? ????? ????? ?????. https://helloworld.com?h=bba4fefa5b6bd941414fa5269c7a72a1&


Buy legal anabolic steroids https://myfsk.org/community/account/buy-legal-anabolic-steroids/?h=bba4fefa5b6bd941414fa5269c7a72a1& 13-12-2020
Buy legal anabolic steroids https://myfsk.org/community/account/buy-legal-anabolic-steroids/?h=bba4fefa5b6bd941414fa5269c7a72a1&


<p><a href="https://f3gxp.page.link/Tbeh"><img src="https://i.ibb.co/rH6Ky7F/best-hookup-sites-fs.jpg"></a></p>?h=bba4fefa5b6bd941414fa5269c7a72a1& 20-12-2020
<p><a href="https://f3gxp.page.link/Tbeh"><img src="https://i.ibb.co/rH6Ky7F/best-hookup-sites-fs.jpg"></a></p>?h=bba4fefa5b6bd941414fa5269c7a72a1&


<p><a href="https://f3gxp.page.link/Tbeh"><img src="https://i.ibb.co/rH6Ky7F/best-hookup-sites-fs.jpg"></a></p>?h=bba4fefa5b6bd941414fa5269c7a72a1& 21-12-2020
<p><a href="https://f3gxp.page.link/Tbeh"><img src="https://i.ibb.co/rH6Ky7F/best-hookup-sites-fs.jpg"></a></p>?h=bba4fefa5b6bd941414fa5269c7a72a1&


JbnvTorgo 13-02-2021
ge money check my loan balance <a href="http://samcash21.com/ ">highest rated payday loan company</a> payday loans gilroy ca


New Comment

Name
E-mail (not published)
Comment
Enter the code shown: