how to upload files?

Please post public support tickets here. Note: for private support tickets, please send an email to support@cshtml5.com instead.
maoming
Posts: 1
Joined: Mon Nov 20, 2017 4:14 pm

how to upload files?

Postby maoming » Mon Nov 20, 2017 4:21 pm

Hi,
cshtml5 how to upload files? Is there such an example? Thank you!

JS-Support
Site Admin
Posts: 811
Joined: Tue Apr 08, 2014 3:42 pm

Re: how to upload files?

Postby JS-Support » Wed Nov 22, 2017 6:12 am

Hi and welcome to the forums.

Uploading a file with CSHTML5 works the same as in Silverlight. Most of the required work in done server-side. For example, if your server is based on asp.net, you can create a IHttpHandler that receives the file. On the client side, all you have to do is call the method "WebClient.UploadString(Uri address, string data)".

For a complete tutorial, please read the following page:
http://www.c-sharpcorner.com/uploadfile/nipuntomar/file-upload-in-silverlight/

The only difference in CSHTML5 compared to the tutorial above is that you need to replace "WebClient.OpenWrite" with "WebClient.UploadString" because "WebClient.OpenWrite" is not yet supported in CSHTML5 at the time of writing.

If you follow the tutorial and run into any issues, please feel free to post a simple VS project that reproduces the issue and we will look into your issues.

Thanks.
Regards,
JS-Support


Return to “Technical Support”

Who is online

Users browsing this forum: Google [Bot] and 1 guest